import formJs from "./regexDetail.js"; //新增弹框配置项
import publicForm from "@/components/public/up-form.vue"; //弹框form  照片必填用
import publicForm1 from "@/components/public/el-form.vue"; //弹框form
import CustomDialog from "@/components/sampleManage/WBSfieldSampling/index.vue";

import tree from "@/components/TensionAndGrout/tree";
import TableData from "@/components/public/el-table-pagination"; //列表
// import TableData from "@/components/HntManage/el-tables"; //列表
// import Pagination from "@/components/public/el-pagination"; //分页
import publicForm2 from "@/components/materialDataManage/fromCom.vue"; //弹框form

import {
    // 取样
    getSampleWorkByAdd, //预新增
    getSampleWorkByFid, //详情
    saveSampleWork, //保存
    getBaseDataitemDetailByItemCode, //字典项
    getUserCompanyTreeList, //机构树
    getEntryledgerPageLists, //材料进场编号--列表
    getfSampletype, //获取样品种类
    getSampleWorkDateByAdd, //根据取样时间查询样品编号接口
    getSampleNoIsUse, //查询试件编号是否被使用接口
    getPurveyorDataList, //厂家
    getSampleHistoryList, //历史记录
    // 取样

    // 收样
    getSampleWorkTestByFid, //详情
    saveSampleCollection, //保存
    postTestList, //获取试验名称--成都
    postCreateNo, //生成样品/报告编号--成都
    getSampleSxList, //获取检验对象属性--成都
    register, // 保存取样登记数据--成都
    // 树选人
    getBaseDepartmentUser, //查人员
    // 树选人
    // 收样

    getSpeciesDataList

} from "@/api/request.js";


export default {
    props: [
        "dialogVisible", //弹框是否展示
        "dialogTitle", //标题
        "statusNum", //按钮编号 1新增   2编辑取样   3编辑收样  7查看
        "currentRow", //当前行
        "fCompanyid",
        "fCompanyname",
        "displaySwitching", //切换是否展示  2取样&收样；0取样；1收样
    ],
    data() {
        return {
            searchObj: [{
                select: true, //是input
                label: ".", //字段
                prop: "keyType", //字段名
                width: 5, //参考el-col
                disabled: false, //是否禁用
                placeholder: "材料种类",
                options: []

            },

            ],
            SyrjUrl: null, //动态请求前缀
            // 页签切换
            typeData: [{
                text: "样品取样",
                show: true
            },
            {
                text: "样品收样",
                show: false
            },
            ],
            identification: null,
            // 页签切换
            visible: "", //弹框展示隐藏
            title: null, //弹框标题
            isLock: false, //取样按钮是否显示
            dialogHeight: null, //弹框高度
            // 取样
            fileList: [], //照片
            fSourcefileList: [], //视频
            selected: [], //多选接值 
            timeYMD: null, //当前日期
            timeYmdHms: null,
            btnShow: true,

            formObj: formJs.formObjText_zj,
            // 外委取样
            formObjText: formJs.formObjText, //编辑
            formObjText1: formJs.formObjText1, //编辑
            formObjLook: formJs.formObjLook, //查看
            // 外委取样

            // 自检取样
            // 原值
            formObjText_zj: formJs.formObjText_zj, //编辑
            formObjLook_zj: formJs.formObjLook_zj, //查看
            // 土
            formObjText_zj1: formJs.formObjText_zj1, //编辑
            formObjLook_zj1: formJs.formObjLook_zj1, //查看
            // 粗集料/细集料/矿粉/岩石
            formObjText_zj2: formJs.formObjText_zj2, //编辑---粗集料/细集料/岩石
            formObjText_zj3: formJs.formObjText_zj3, //编辑---矿粉
            formObjLook_zj2: formJs.formObjLook_zj2, //查看---粗集料/细集料/矿粉/岩石
            // 水泥
            formObjText_zj4: formJs.formObjText_zj4, //编辑
            formObjLook_zj4: formJs.formObjLook_zj4, //查看
            // 水
            formObjText_zj5: formJs.formObjText_zj5, //编辑
            formObjLook_zj5: formJs.formObjLook_zj5, //查看
            // 外加剂
            formObjText_zj6: formJs.formObjText_zj6, //编辑
            formObjLook_zj6: formJs.formObjLook_zj6, //查看
            // 石灰
            formObjText_zj7: formJs.formObjText_zj7, //编辑
            formObjLook_zj7: formJs.formObjLook_zj7, //查看
            // 粉煤灰
            formObjText_zj8: formJs.formObjText_zj8, //编辑
            formObjLook_zj8: formJs.formObjLook_zj8, //查看
            // 普通沥青
            formObjText_zj9: formJs.formObjText_zj9, //编辑
            formObjLook_zj9: formJs.formObjLook_zj9, //查看
            // 钢筋原材
            formObjText_zj10: formJs.formObjText_zj10, //编辑
            formObjLook_zj10: formJs.formObjLook_zj10, //查看
            // 水泥混凝土拌合物
            formObjText_zj11: formJs.formObjText_zj11, //编辑
            formObjLook_zj11: formJs.formObjLook_zj11, //查看
            // 硬化后水泥混凝土
            formObjText_zj12: formJs.formObjText_zj12, //编辑
            formObjLook_zj12: formJs.formObjLook_zj12, //查看
            // 水泥砂浆拌合物
            formObjText_zj13: formJs.formObjText_zj13, //编辑
            formObjLook_zj13: formJs.formObjLook_zj13, //查看
            // 硬化后水泥砂浆
            formObjText_zj14: formJs.formObjText_zj14, //编辑
            formObjLook_zj14: formJs.formObjLook_zj14, //查看
            // 硬化后水泥净浆
            formObjText_zj15: formJs.formObjText_zj15, //编辑
            formObjLook_zj15: formJs.formObjLook_zj15, //查看
            // 沥青混合料
            formObjText_zj16: formJs.formObjText_zj16, //编辑
            formObjLook_zj16: formJs.formObjLook_zj16, //查看
            // 水泥混凝土抗弯拉、水泥抗折抗压强度
            formObjText_zj17: formJs.formObjText_zj17, //编辑

            formObjLook_zj17: formJs.formObjLook_zj17, //查看
            // 钢筋焊接、钢筋机械连接、
            formObjText_zj18: formJs.formObjText_zj18, //编辑
            formObjLook_zj18: formJs.formObjLook_zj18, //查看
            // 钢筋焊接、钢筋机械连接、
            // 自检取样
            formData: {
                fId: "", //传fid表示修改 不传表示新增
                userId: "", //当前登录人id
                userName: "", //当前登录人姓名
                fCompanyid: "", //施工单位id 隐藏
                fCompanyname: "", //施工单位名称 隐藏
                fProjectid: "", //项目id 隐藏
                fProjectname: "", //项目名称 隐藏
                fChecktypenum: "", //0自检1外委
                fChecktype: "", //检测类型  施工自检,施工外委/监理抽检,监理外委
                fEntryledgerid: "", //材料进场编号id 隐藏
                fEntrynumber: "", //材料进场编号
                fMaterialtypeid: "", //材料进场材料种类id
                fSamplenostr: "", //取样编号
                fSampletype: "", //样品种类id 隐藏
                fSampletypename: "", //样品种类汉字
                fVarietyid: "",
                fSamplemodel: "", //样品编码
                fSamplespecs: "", //样品规格
                fSamplemessage: "", //样品描述
                fBusinessscopename: "", //取样标段
                fBusinessscopecompanyid: "",
                fSamplename: "", //样品名称
                fDeputynum: "", //代表数量
                fSampleno: "", //生产批号  沥青标号  出厂编号
                fTesttype: "", //沥青种类  钢筋种类 混凝土种类  砂浆种类 钢筋种类
                fSampletestpiece: "", //试件编号
                fStrengthgrade: "", //品种等级 品种强度等级 强度等级
                fSpecimenage: "", //养护龄期  
                SpecimenageList: [], //养护龄期--页面展示
                fSpecimensize: "", //试件尺寸  
                fProductiondate: "", //制件日期  生产日期
                fProductiondates: "", //制件日期  
                fBrand: " ", //牌号   
                fDiameter: "", //直径	  
                fManufacturer: "", //生产厂家
                fPlace: "", //产地
                fAddress: "", //取样地点
                fProjectlocation: "", //工程部位/用途
                fProjectlocationid: '', //工程部位/用途id
                fApproachdates: "", //进场日期
                fSampledates: "", //取样日期
                fSampleperson: "", //取样人
                fSamplepersonid: "", //取样人id
                fWitnessperson: "", //见证人
                fNote: "", //备注
                fLon: "", //经度
                fLat: "", //纬度
                recordfiles: [], //删除文件id集合
                fPhotofile: "", //取样现场照片id
                fSourcefile: "", //现场取样视频件id
                fSamplenum: "", //外加剂掺量
                fMixingmethod: "", //搅拌方式
                fWarecondition: "", //养护条件
                fTestlayer: "", //试验层位
                fGradationtype: "", //级配类型
                isSubmit: "0", //0 保存 1提交
                fLocationid: "",
            },
            recordfiles: [], //删除文件合集
            fSampletypeList: [], //样品种类总集合
            // 材料进场编号
            // 左侧机构树
            treelength: true, //左侧树显示隐藏
            showName: "未选择公司",
            treeData: [], //左侧树状图数据
            checkData: [],
            // 左侧机构树
            loading: false, //列表转载
            loadingEditDialog_cl: false, //弹框loading
            dialogEditVisible_cl: false, //新增弹框是否显示
            navigatepageNums_cl: null, //是否显示分页
            queryCriteriaData_cl: {},
            getList_cl: {
                fCompanyid: "", //左侧选中组织机构id
                userId: "", //查询待办或已办时传 列表页查询不传
                modelType: 2, //0-待办 1-已办 传2 表示列表页查询
                keyType: "", //上方查询条件材料种类
                taskNumber: "", //上方查询条件进场编号
                startDates: "", //进场开始时间
                endDates: "", //进场结束时间
                page: 1, //当前页码
                pageSize: 15, //每页显示条数
                isTestNum: "是"
            },
            table_config_cl: formJs.table_config_cl,
            tableData_cl: [], //表格列表数据列表
            row_cl: {
                fId: "",
            }, //列表当前行信息
            // 材料进场编号
            WBSShow: false, // WBS
            // 取样


            // 收样
            formObjAccept: formJs.formObjAcceptText,
            formObjAcceptText: formJs.formObjAcceptText, //编辑--试件类型无值
            formObjAcceptLook: formJs.formObjAcceptLook, //查看--试件类型无值
            formDataAccept: {
                fId: "", //传fid表示修改 不传表示新增
                userId: "", //当前登录人id
                userName: "", //当前登录人姓名
                fSamplereportid: "", //试验名称*
                fSamplereportname: "", //试验名称id*
                fCompletiondates: "", //预计完成日期*
                fTestperson: "", //试验人
                fTestpersonid: "", //试验人id
                fTestnote: "", //备注
                fSampleassignnostr: "", //样品编号
                fSamplereportnostr: "", //报告编号
                fCollectiondates: this.common.day(0)
            },
            TestMessage: {},
            postTestList: [], //试验名称合集
            PostSample: "", //生成样品编号
            PostReport: "", //生成报告编号
            SampleSxList: [], //获取检验对象属性
            registerList: {}, //保存取样登记数据
            header: {
                accessToken: "",
                projectId: "",
            },
            // 树选人
            dialogEditVisibleTree: false,
            loadingEditDialogTree: false,
            companyInfo: [], //公司树信息
            highlightBd: true,
            defaultProps: {
                children: "children",
                label: "fShortname",
            },
            departmentList: [], //部门
            num: null,
            personList: [], //人员列表新增
            checkboxGroup1: [],
            boys: require("@/assets/img/organization/boys.png"),
            girls: require("@/assets/img/organization/girls.png"),
            newData: null,
            treeText: {
                companyId: null,
                userId: null,
                text: null,
            },
            propText: null,
            candidate: null,
            // 树选人
            // 收样

            userInfo: {}, //登录用户

            currentDetail: null,
            fCompanynames: null,
            fCompanyids: null,

        };
    },
    components: {
        publicForm,
        tree,
        TableData,
        publicForm1,
        CustomDialog,
        publicForm2
    },
    watch: {
        dialogVisible: {
            handler(newVal) {
                if (newVal) {
                    this.visible = newVal;
                }
            },
            immediate: true,
        },
        dialogTitle: {
            handler(newVal) {
                if (newVal) {
                    this.title = newVal;
                }
            },
            immediate: true,
        },
        statusNum: {
            handler(newVal) {
                if (newVal) {
                    this.edit(newVal);
                }

            },
            immediate: true,
        },

        currentRow: {
            handler(newVal) {
                if (newVal) {
                    this.currentDetail = newVal;
                }
            },
            immediate: true,
        },

        fCompanyid: {
            handler(newVal) {
                if (newVal) {

                    this.fCompanyids = newVal

                }
            },
            immediate: true,
        },
        fCompanyname: {
            handler(newVal) {
                if (newVal) {
                    this.fCompanynames = newVal

                }
            },
            immediate: true,
        },
        displaySwitching: {
            handler(newVal) {
                if (newVal) {
                    this.displaySwitching = newVal;
                    if (newVal == 1) {
                        // this.typeData[0].show = false;
                        this.typeData[1].show = true;
                    } else {
                        this.typeData[0].show = true;
                        // this.typeData[1].show = false;
                    }
                }
            },
            immediate: true,
        },
    },
    created() {
        window.addEventListener("resize", this.getHeight);
        this.getHeight();
    }, //获取页面高度自适应：formObjText_zj

    destroyed() {
        window.removeEventListener("resize", this.getHeight);
        this.getHeight();
    },
    mounted() {
        this.userInfo = JSON.parse(sessionStorage.getItem("GxBack-userInfo"));
        this.getSpeciesList()
        if (this.userInfo.companyNature == "施工单位") {
            this.formObjText[1].disabled = false; //外委取样
            this.formObjText1[1].disabled = false; //外委取样
            //自检取样

            //自检取样

            // 取样标段
            this.formObjText[6] = {
                input: true, //是input
                label: "取样标段", //字段
                prop: "fBusinessscopename", //字段名
                width: 12, //参考el-col
                disabled: true, //是否禁用
                rules: [{
                    required: true,
                    message: '取样标段不能为空'
                }] //验证
            };
            this.formObjText1[6] = {
                input: true, //是input
                label: "取样标段", //字段
                prop: "fBusinessscopename", //字段名
                width: 12, //参考el-col
                disabled: true, //是否禁用
                rules: [{
                    required: true,
                    message: '取样标段不能为空'
                }] //验证
            };
            this.formObjText_zj[5] = {
                input: true, //是input
                label: "取样标段", //字段
                prop: "fBusinessscopename", //字段名
                width: 12, //参考el-col
                disabled: true, //是否禁用
                rules: [{
                    required: true,
                    message: '取样标段不能为空'
                }] //验证
            };
            this.formObjText_zj1[5] = {
                input: true, //是input
                label: "取样标段", //字段
                prop: "fBusinessscopename", //字段名
                width: 12, //参考el-col
                disabled: true, //是否禁用
                rules: [{
                    required: true,
                    message: '取样标段不能为空'
                }] //验证
            };
            this.formObjText_zj2[5] = {
                input: true, //是input
                label: "取样标段", //字段
                prop: "fBusinessscopename", //字段名
                width: 12, //参考el-col
                disabled: true, //是否禁用
                rules: [{
                    required: true,
                    message: '取样标段不能为空'
                }] //验证
            };
            this.formObjText_zj3[5] = {
                input: true, //是input
                label: "取样标段", //字段
                prop: "fBusinessscopename", //字段名
                width: 12, //参考el-col
                disabled: true, //是否禁用
                rules: [{
                    required: true,
                    message: '取样标段不能为空'
                }] //验证
            };
            this.formObjText_zj4[5] = {
                input: true, //是input
                label: "取样标段", //字段
                prop: "fBusinessscopename", //字段名
                width: 12, //参考el-col
                disabled: true, //是否禁用
                rules: [{
                    required: true,
                    message: '取样标段不能为空'
                }] //验证
            };
            this.formObjText_zj5[5] = {
                input: true, //是input
                label: "取样标段", //字段
                prop: "fBusinessscopename", //字段名
                width: 12, //参考el-col
                disabled: true, //是否禁用
                rules: [{
                    required: true,
                    message: '取样标段不能为空'
                }] //验证
            };
            this.formObjText_zj6[5] = {
                input: true, //是input
                label: "取样标段", //字段
                prop: "fBusinessscopename", //字段名
                width: 12, //参考el-col
                disabled: true, //是否禁用
                rules: [{
                    required: true,
                    message: '取样标段不能为空'
                }] //验证
            };
            this.formObjText_zj7[5] = {
                input: true, //是input
                label: "取样标段", //字段
                prop: "fBusinessscopename", //字段名
                width: 12, //参考el-col
                disabled: true, //是否禁用
                rules: [{
                    required: true,
                    message: '取样标段不能为空'
                }] //验证
            };
            this.formObjText_zj8[5] = {
                input: true, //是input
                label: "取样标段", //字段
                prop: "fBusinessscopename", //字段名
                width: 12, //参考el-col
                disabled: true, //是否禁用
                rules: [{
                    required: true,
                    message: '取样标段不能为空'
                }] //验证
            };
            this.formObjText_zj9[5] = {
                input: true, //是input
                label: "取样标段", //字段
                prop: "fBusinessscopename", //字段名
                width: 12, //参考el-col
                disabled: true, //是否禁用
                rules: [{
                    required: true,
                    message: '取样标段不能为空'
                }] //验证
            };
            this.formObjText_zj10[5] = {
                input: true, //是input
                label: "取样标段", //字段
                prop: "fBusinessscopename", //字段名
                width: 12, //参考el-col
                disabled: true, //是否禁用
                rules: [{
                    required: true,
                    message: '取样标段不能为空'
                }] //验证
            };
            this.formObjText_zj11[5] = {
                input: true, //是input
                label: "取样标段", //字段
                prop: "fBusinessscopename", //字段名
                width: 12, //参考el-col
                disabled: true, //是否禁用
                rules: [{
                    required: true,
                    message: '取样标段不能为空'
                }] //验证
            };
            this.formObjText_zj12[5] = {
                input: true, //是input
                label: "取样标段", //字段
                prop: "fBusinessscopename", //字段名
                width: 12, //参考el-col
                disabled: true, //是否禁用
                rules: [{
                    required: true,
                    message: '取样标段不能为空'
                }] //验证
            };
            this.formObjText_zj13[5] = {
                input: true, //是input
                label: "取样标段", //字段
                prop: "fBusinessscopename", //字段名
                width: 12, //参考el-col
                disabled: true, //是否禁用
                rules: [{
                    required: true,
                    message: '取样标段不能为空'
                }] //验证
            };
            this.formObjText_zj14[5] = {
                input: true, //是input
                label: "取样标段", //字段
                prop: "fBusinessscopename", //字段名
                width: 12, //参考el-col
                disabled: true, //是否禁用
                rules: [{
                    required: true,
                    message: '取样标段不能为空'
                }] //验证
            };
            this.formObjText_zj15[5] = {
                input: true, //是input
                label: "取样标段", //字段
                prop: "fBusinessscopename", //字段名
                width: 12, //参考el-col
                disabled: true, //是否禁用
                rules: [{
                    required: true,
                    message: '取样标段不能为空'
                }] //验证
            };
            this.formObjText_zj16[5] = {
                input: true, //是input
                label: "取样标段", //字段
                prop: "fBusinessscopename", //字段名
                width: 12, //参考el-col
                disabled: true, //是否禁用
                rules: [{
                    required: true,
                    message: '取样标段不能为空'
                }] //验证
            };
            this.formObjText_zj17[5] = {
                input: true, //是input
                label: "取样标段", //字段
                prop: "fBusinessscopename", //字段名
                width: 12, //参考el-col
                disabled: true, //是否禁用
                rules: [{
                    required: true,
                    message: '取样标段不能为空'
                }] //验证
            };
            this.formObjText_zj18[5] = {
                input: true, //是input
                label: "取样标段", //字段
                prop: "fBusinessscopename", //字段名
                width: 12, //参考el-col
                disabled: true, //是否禁用
                rules: [{
                    required: true,
                    message: '取样标段不能为空'
                }] //验证
            };
            // 取样标段

        } else {
            this.formObjText[1].disabled = false; //外委取样
            this.formObjText1[1].disabled = false; //外委取样
            //自检取样
            this.formObjText_zj[1].disabled = false;
            this.formObjText_zj1[1].disabled = false;
            this.formObjText_zj2[1].disabled = false;
            this.formObjText_zj3[1].disabled = false;
            this.formObjText_zj4[1].disabled = false;
            this.formObjText_zj5[1].disabled = false;
            this.formObjText_zj6[1].disabled = false;
            this.formObjText_zj7[1].disabled = false;
            this.formObjText_zj8[1].disabled = false;
            this.formObjText_zj9[1].disabled = false;
            this.formObjText_zj10[1].disabled = false;
            this.formObjText_zj11[1].disabled = false;
            this.formObjText_zj12[1].disabled = false;
            this.formObjText_zj13[1].disabled = false;
            this.formObjText_zj14[1].disabled = false;
            this.formObjText_zj15[1].disabled = false;
            this.formObjText_zj16[1].disabled = false;
            this.formObjText_zj17[1].disabled = false;
            this.formObjText_zj18[1].disabled = false;

            //自检取样


            // 取样标段
            this.formObjText[6] = {
                select: true, //是input
                options: [],
                label: "取样标段", //字段
                prop: "fBusinessscopename", //字段名
                width: 12, //参考el-col
                disabled: false, //是否禁用
                rules: [{
                    required: true,
                    message: '取样标段不能为空'
                }] //验证
            };
            this.formObjText1[6] = {
                select: true, //是input
                options: [],
                label: "取样标段", //字段
                prop: "fBusinessscopename", //字段名
                width: 12, //参考el-col
                disabled: false, //是否禁用
                rules: [{
                    required: true,
                    message: '取样标段不能为空'
                }] //验证
            };
            this.formObjText_zj[5] = {
                select: true, //是input
                options: [],
                label: "取样标段", //字段
                prop: "fBusinessscopename", //字段名
                width: 12, //参考el-col
                disabled: false, //是否禁用
                rules: [{
                    required: true,
                    message: '取样标段不能为空'
                }] //验证
            };
            this.formObjText_zj1[5] = {
                select: true, //是input
                options: [],
                label: "取样标段", //字段
                prop: "fBusinessscopename", //字段名
                width: 12, //参考el-col
                disabled: false, //是否禁用
                rules: [{
                    required: true,
                    message: '取样标段不能为空'
                }] //验证
            };

            this.formObjText_zj2[5] = {
                select: true, //是input
                options: [],
                label: "取样标段", //字段
                prop: "fBusinessscopename", //字段名
                width: 12, //参考el-col
                disabled: false, //是否禁用
                rules: [{
                    required: true,
                    message: '取样标段不能为空'
                }] //验证
            };

            this.formObjText_zj3[5] = {
                select: true, //是input
                options: [],
                label: "取样标段", //字段
                prop: "fBusinessscopename", //字段名
                width: 12, //参考el-col
                disabled: false, //是否禁用
                rules: [{
                    required: true,
                    message: '取样标段不能为空'
                }] //验证
            };

            this.formObjText_zj4[5] = {
                select: true, //是input
                options: [],
                label: "取样标段", //字段
                prop: "fBusinessscopename", //字段名
                width: 12, //参考el-col
                disabled: false, //是否禁用
                rules: [{
                    required: true,
                    message: '取样标段不能为空'
                }] //验证
            };
            this.formObjText_zj5[5] = {
                select: true, //是input
                options: [],
                label: "取样标段", //字段
                prop: "fBusinessscopename", //字段名
                width: 12, //参考el-col
                disabled: false, //是否禁用
                rules: [{
                    required: true,
                    message: '取样标段不能为空'
                }] //验证
            };


            this.formObjText_zj6[5] = {
                select: true, //是input
                options: [],
                label: "取样标段", //字段
                prop: "fBusinessscopename", //字段名
                width: 12, //参考el-col
                disabled: false, //是否禁用
                rules: [{
                    required: true,
                    message: '取样标段不能为空'
                }] //验证
            };
            this.formObjText_zj7[5] = {
                select: true, //是input
                options: [],
                label: "取样标段", //字段
                prop: "fBusinessscopename", //字段名
                width: 12, //参考el-col
                disabled: false, //是否禁用
                rules: [{
                    required: true,
                    message: '取样标段不能为空'
                }] //验证
            };
            this.formObjText_zj8[5] = {
                select: true, //是input
                options: [],
                label: "取样标段", //字段
                prop: "fBusinessscopename", //字段名
                width: 12, //参考el-col
                disabled: false, //是否禁用
                rules: [{
                    required: true,
                    message: '取样标段不能为空'
                }] //验证
            };
            this.formObjText_zj9[5] = {
                select: true, //是input
                options: [],
                label: "取样标段", //字段
                prop: "fBusinessscopename", //字段名
                width: 12, //参考el-col
                disabled: false, //是否禁用
                rules: [{
                    required: true,
                    message: '取样标段不能为空'
                }] //验证
            };
            this.formObjText_zj10[5] = {
                select: true, //是input
                options: [],
                label: "取样标段", //字段
                prop: "fBusinessscopename", //字段名
                width: 12, //参考el-col
                disabled: false, //是否禁用
                rules: [{
                    required: true,
                    message: '取样标段不能为空'
                }] //验证
            };

            this.formObjText_zj11[5] = {
                select: true, //是input
                options: [],
                label: "取样标段", //字段
                prop: "fBusinessscopename", //字段名
                width: 12, //参考el-col
                disabled: false, //是否禁用
                rules: [{
                    required: true,
                    message: '取样标段不能为空'
                }] //验证
            };
            this.formObjText_zj12[5] = {
                select: true, //是input
                options: [],
                label: "取样标段", //字段
                prop: "fBusinessscopename", //字段名
                width: 12, //参考el-col
                disabled: false, //是否禁用
                rules: [{
                    required: true,
                    message: '取样标段不能为空'
                }] //验证
            };
            this.formObjText_zj13[5] = {
                select: true, //是input
                options: [],
                label: "取样标段", //字段
                prop: "fBusinessscopename", //字段名
                width: 12, //参考el-col
                disabled: false, //是否禁用
                rules: [{
                    required: true,
                    message: '取样标段不能为空'
                }] //验证
            };
            this.formObjText_zj14[5] = {
                select: true, //是input
                options: [],
                label: "取样标段", //字段
                prop: "fBusinessscopename", //字段名
                width: 12, //参考el-col
                disabled: false, //是否禁用
                rules: [{
                    required: true,
                    message: '取样标段不能为空'
                }] //验证
            };
            this.formObjText_zj15[5] = {
                select: true, //是input
                options: [],
                label: "取样标段", //字段
                prop: "fBusinessscopename", //字段名
                width: 12, //参考el-col
                disabled: false, //是否禁用
                rules: [{
                    required: true,
                    message: '取样标段不能为空'
                }] //验证
            };
            this.formObjText_zj16[5] = {
                select: true, //是input
                options: [],
                label: "取样标段", //字段
                prop: "fBusinessscopename", //字段名
                width: 12, //参考el-col
                disabled: false, //是否禁用
                rules: [{
                    required: true,
                    message: '取样标段不能为空'
                }] //验证
            };
            this.formObjText_zj17[5] = {
                select: true, //是input
                options: [],
                label: "取样标段", //字段
                prop: "fBusinessscopename", //字段名
                width: 12, //参考el-col
                disabled: false, //是否禁用
                rules: [{
                    required: true,
                    message: '取样标段不能为空'
                }] //验证
            };
            this.formObjText_zj18[5] = {
                select: true, //是input
                options: [],
                label: "取样标段", //字段
                prop: "fBusinessscopename", //字段名
                width: 12, //参考el-col
                disabled: false, //是否禁用
                rules: [{
                    required: true,
                    message: '取样标段不能为空'
                }] //验证
            };

            // 取样标段
        }
        //外委取样
        this.formObjText[5].disabled = false;
        this.formObjText[7].disabled = false;
        this.formObjText[10].disabled = false;
        this.formObjText[16].disabled = false;
        this.formObjText1[5].disabled = false;
        this.formObjText1[7].disabled = false;
        this.formObjText1[10].disabled = false;
        this.formObjText1[16].disabled = false;
        //外委取样

        // 材料进场编号参数
        this.getList_cl = {
            fCompanyid: this.userInfo.companyId, //左侧选中组织机构id
            userId: this.userInfo.userId, //查询待办或已办时传 列表页查询不传
            modelType: 2, //0-待办 1-已办 传2 表示列表页查询
            keyType: "", //上方查询条件材料种类
            taskNumber: "", //上方查询条件进场编号
            startDates: "", //进场开始时间
            endDates: "", //进场结束时间
            page: 1, //当前页码
            pageSize: 15, //每页显示条数
        };
        this.btnShow = true;
        if (this.statusNum == 1) { //新增
            this.formObj = this.formObjText_zj;
            this.addition(0); //取样

        } else if (this.statusNum == 2 || this.statusNum == 3) { //2编辑取样，3编辑收样
            if (this.displaySwitching == 2) {
                this.typeData[0].show = false;
                this.typeData[1].show = true;
            }
            this.getDetail({
                fId: this.currentDetail.fId
            }) //取样
        } else if (this.statusNum == 7) { //查看
            this.btnShow = false //按钮
            if (this.displaySwitching == 3) { //材料委托单------查看
                this.getDetail({
                    fId: this.currentDetail.fSid
                }) // currentRow
            } else {
                this.getDetail({
                    fId: this.currentDetail.fId
                }) // currentRow
            }
        }
        this.getHeight();
        this.getData();
    },
    methods: {
        getSpeciesList() {
            var obj = {
                page: 1,
                pageSize: 500
            }
            getSpeciesDataList(obj)
                .then((res) => {
                    if (res.errcode == 0) {

                        this.searchObj[0].options = [{
                            label: "请选择材料种类",
                            value: "",
                        }]
                        res.data.pageInfo.list.map(item => {
                            if (item.fStatus == 1) {
                                this.searchObj[0].options.push({
                                    label: item.fVarietyname,
                                    value: item.fVarietyname,
                                    children: item.materialList
                                })
                            }
                        })

                    } else {
                        this.$message.error(res.msg);
                        return false;
                    }
                })
                .catch(() => {
                    return false;
                });
        },
        getSampleHistoryList(data, num) {

            getSampleHistoryList(data).then(res => {

                if (res.errcode == 0) {
                    var fSamplenameNum;
                    var fSamplemessageNum;
                    var fSamplespecsNum;
                    this.formObj.map((item, index) => {
                        if (item.prop == 'fSamplename') {
                            fSamplenameNum = index //样品名称Index
                        } else if (item.prop == 'fSamplemessage') {
                            fSamplemessageNum = index //样品描述Index
                        } else if (item.prop == 'fSamplespecs') {
                            fSamplespecsNum = index //规格型号Index
                        }
                    })
                    if (this.formData.fChecktypenum == 1) { //外委
                        this.formObj[fSamplespecsNum].options = [] //规格型号
                        res.data.fSamplespecslist.map(item => {
                            this.formObj[fSamplespecsNum].options.push({ //规格型号
                                label: item.keyvalue,
                                value: item.keyvalue,
                            })
                        })
                    }

                    this.formObj[fSamplenameNum].options = [] //样品名称
                    this.formObj[fSamplemessageNum].options = [] //样品描述

                    res.data.fSamplenamelist.map(item => {
                        this.formObj[fSamplenameNum].options.push({ //样品名称
                            label: item.keyvalue,
                            value: item.keyvalue,
                        })
                    })
                    if (num == 0) {
                        res.data.fSamplemessagelist.map(item => {
                            this.formObj[fSamplemessageNum].options.push({ //样品描述
                                label: item.keyvalue,
                                value: item.keyvalue,
                            })
                        })
                    } else {
                        this.formObj[fSamplemessageNum].options = [{ //样品描述
                            label: "表面平整，无蜂窝麻面，无缺损",
                            value: "表面平整，无蜂窝麻面，无缺损",
                        }]
                    }

                }
            })
        },
        // 页签切换
        changeType(e, index) {
            for (let i in this.typeData) {
                if (parseFloat(i) === index) {
                    this.typeData[i].show = true;
                } else {
                    this.typeData[i].show = false;
                }
            }
            // this.typeDataNum = index;
        },
        // 页签切换
        getHeight() {
            var h = document.documentElement.clientHeight; //获取页面可见高度
            this.dialogHeight = h * 0.76 + "px";
        },

        closeDialog() {
            this.$emit("close");
        },
        // 
        // selectBlur(value, index, prop) {
        //     console.log("selectBlur", value, index, prop);
        //     if (prop == 'fSamplename') {
        //         this.formData.fSamplename = value
        //     }
        //     this.$forceUpdate(); // 强制更新
        // },
        selectChange(value, index, prop) {
            console.log(value, index, prop);
            if (prop == 'fBusinessscopename') {
                this.formData.fBusinessscopecompanyid = value.value;
                this.formData.fBusinessscopename = value.label;

                this.formData.fCompanyid = value.value; //施工单位id 隐藏
                this.formData.fCompanyname = value.label; //施工单位名称 隐藏
                this.addition(1); //取样
            }
            if (prop == 'fSamplename') {
                this.formData.fSamplename = value.label || value
            }
            if (prop == 'fSamplemessage') {
                this.formData.fSamplemessage = value.label || value

            }
            if (prop == 'fSamplespecs') {
                this.formData.fSamplespecs = value.label || value
            }

            //收样----试验机名称
            if (prop == "fSamplereportname") {
                if (value == "==请选择==") {
                    this.formDataAccept.fSamplereportid = "";
                    this.formDataAccept.fSamplereportname = "";
                    this.identification = ""
                } else {
                    this.postTestList.map((item) => {
                        if (value == item.key) {
                            this.formDataAccept.fSamplereportid = item.val;
                            this.identification = item.identification;
                        }
                    });
                }
            }
            // 取样日期
            if (prop == "fSampledates") {
                var currentDate = [],
                    SelectDate = [];
                currentDate = this.timeYMD.split("-");
                SelectDate = value.split("-");
                if (this.statusNum == 1 || this.statusNum == 2) {
                    if (currentDate[0] != SelectDate[0] || currentDate[1] != SelectDate[1]) {
                        this.getEntrynumber(value);
                    }
                }

            }
        },
        inputFocus(index, prop) {
            // console.log("inputFocus", index, prop);
            if (prop == "fEntrynumber") {
                this.getTree("fEntrynumber");
            }

            return index, prop;
        },

        edit() {
            this.formData = this.$options.data.call(this).formData;
            this.formDataAccept = this.$options.data.call(this).formDataAccept;
        },

        // 刪除文件
        delteFile(file) {
            for (let index = 0; index < this.fileList.length; index++) {
                if (file.uid == this.fileList[index].uid) {
                    if (this.fileList[index].atta == undefined) {
                        this.recordfiles.push({
                            fId: this.fileList[index].fId,
                        });
                    } else {
                        this.recordfiles.push({
                            fId: this.fileList[index].atta.fId,
                        });
                    }
                    this.fileList.splice(index, 1);
                }
            }
        },

        handleNode(data) {
            if (data.fSampletypename == "硬化后水泥混凝土") {
                this.getSampleHistoryList({
                    fCompanyid: this.userInfo.companyId, // 当前数据组织机构id
                    sampleType: data.fSampletype // "fSampletype": "样品种类"
                }, 1)
            } else {
                this.getSampleHistoryList({
                    fCompanyid: this.userInfo.companyId, // 当前数据组织机构id
                    sampleType: data.fSampletype // "fSampletype": "样品种类"
                }, 0)
            }
            // console.log("样品种类", data);

            // this.formData.fAddress = "";//取样地点
            // this.formData.fDeputynum = "";//代表数量
            // this.formData.fSamplespecs = "";//规格型号
            // this.formData.fPlace = "";//产地
            // this.formData.fSampleno = "";//生产批号  沥青标号  出厂编号
            // this.formData.fManufacturer = "";//生产厂家
            // this.formData.fProductiondate = "";//制件日期  生产日期
            this.formData.fSamplenum = ""; //外加剂掺量
            this.formData.fStrengthgrade = ""; //品种等级 品种强度等级 强度等级
            this.formData.fDiameter = ""; //钢筋直径
            this.formData.fSpecimenage = ""; //养护龄期
            this.formData.SpecimenageList = []; //养护龄期
            this.formData.fSpecimensize = ""; //试件尺寸
            this.formData.fSampletestpiece = ""; //试件编号
            this.formData.fTesttype = ""; //沥青种类  钢筋种类 混凝土种类  砂浆种类 钢筋种类
            this.formData.fMixingmethod = ""; //搅拌方式
            this.formData.fWarecondition = ""; //养护条件
            this.formData.fTestlayer = ""; //试验层位
            this.formData.fGradationtype = ""; //级配类型

            if (this.formData.fChecktypenum == "0") {
                if (data.fSampletypename == "土") {
                    this.formObj = this.formObjText_zj1;
                } else if (data.fSampletypename == "粗集料" || data.fSampletypename == "细集料" || data.fSampletypename == "岩石") {
                    this.formObj = this.formObjText_zj2;
                    if (data.fSampletypename == "粗集料") {
                        this.getDictionaryCode("Speci1");
                    } else if (data.fSampletypename == "细集料") {
                        this.getDictionaryCode("Speci2");
                    } else if (data.fSampletypename == "岩石") {
                        this.getDictionaryCode("Speci3");
                    }
                } else if (data.fSampletypename == "矿粉") {
                    this.formObj = this.formObjText_zj3;
                } else if (data.fSampletypename == "水泥") {
                    this.formObj = this.formObjText_zj4;
                } else if (data.fSampletypename == "水") {
                    this.formObj = this.formObjText_zj5;
                } else if (data.fSampletypename == "外加剂") {
                    this.formObj = this.formObjText_zj6;
                } else if (data.fSampletypename == "石灰") {
                    this.formObj = this.formObjText_zj7;
                    this.getDictionaryCode("Variety1");
                } else if (data.fSampletypename == "粉煤灰") {
                    this.formObj = this.formObjText_zj8;
                } else if (data.fSampletypename == "普通沥青") {
                    this.formObj = this.formObjText_zj9;
                    this.getDictionaryCode("Grade1");
                } else if (data.fSampletypename == "钢筋原材") {
                    this.formObj = this.formObjText_zj10;
                    this.getDictionaryCode("Diameter");
                    this.getDictionaryCode("Brand");
                } else if (data.fSampletypename == "水泥混凝土拌合物") {
                    this.formObj = this.formObjText_zj11;
                    this.getDictionaryCode("StrengthGrade1");
                    this.getDictionaryCode("Hnttype1");
                    this.getDictionaryCode("StirringMethod1");
                } else if (data.fSampletypename == "硬化后水泥混凝土") {
                    this.formObj = this.formObjText_zj12;
                    this.getDictionaryCode("StrengthGrade1");
                    this.getDictionaryCode("Hnttype1");
                    this.getDictionaryCode("StirringMethod1");
                    this.getDictionaryCode("CuringCondition");
                    this.getDictionaryCode("SpecimenAge1");
                    this.getDictionaryCode("SpecimenSize1");

                } else if (data.fSampletypename == "水泥砂浆拌合物") {
                    this.formObj = this.formObjText_zj13;
                    this.getDictionaryCode("StirringMethod1");
                } else if (data.fSampletypename == "硬化后水泥砂浆") {
                    this.formObj = this.formObjText_zj14;
                    this.getDictionaryCode("StrengthGrade3");
                    this.getDictionaryCode("StirringMethod1");
                    this.getDictionaryCode("CuringCondition");
                    this.getDictionaryCode("SpecimenAge3");
                    this.getDictionaryCode("SpecimenSize3");
                } else if (data.fSampletypename == "硬化后水泥净浆") {
                    this.formObj = this.formObjText_zj15;
                    this.getDictionaryCode("StirringMethod1");
                    this.getDictionaryCode("StrengthGrade4");

                    this.getDictionaryCode("CuringCondition");
                } else if (data.fSampletypename == "沥青混合料") {
                    this.formObj = this.formObjText_zj16;
                } else if (data.fSampletypename == "水泥混凝土抗弯拉" || data.fSampletypename == "水泥抗折抗压强度") {
                    this.formObj = this.formObjText_zj17;
                } else if (data.fSampletypename == "钢筋焊接" || data.fSampletypename == "钢筋机械连接") {
                    this.formObj = this.formObjText_zj18;
                    this.getDictionaryCode("Diameter");
                    this.getDictionaryCode("Brand");
                } else {
                    this.formObj = this.formObjText_zj;
                }
            } else if (this.formData.fChecktypenum == "1") {
                var that = this;
                if (data.fSampletypename == "粗集料" || data.fSampletypename == "细集料" || data.fSampletypename == "钢筋原材") {
                    that.formObj = that.formObjText1;
                    if (data.fSampletypename == "粗集料") {
                        that.getDictionaryCode("Speci1");
                    } else if (data.fSampletypename == "细集料") {
                        that.getDictionaryCode("Speci2");
                    } else if (data.fSampletypename == "钢筋原材") {
                        that.getDictionaryCode("Brand");
                    }
                } else {
                    that.formObj = that.formObjText;
                }
            }

            this.formData.fSampletype = data.fSampletype; //样品种类id 隐藏
            this.formData.fSampletypename = data.fSampletypename; //样品种类汉字
            this.formData.fSamplemodel = data.fSamplemodel; //样品编码
            this.formData.fVarietyid = data.fVarietyid; //调厂家用id
            this.getPurveyorData(data.fVarietyid);
        },
        changeRadio(num) {
            // console.log("changeRadio",this.statusNum,num);
            this.formObjText[10].options = [];
            this.formObjText1[5].options = [];
            this.formObjText1[10].options = [];
            this.formObjText_zj4[10].options = [];
            this.formObjText_zj6[9].options = [];
            this.formObjText_zj7[10].options = [];
            this.formObjText_zj8[9].options = [];

            this.formObjText[10].placeholder = "请先选择样品种类";
            this.formObjText1[5].placeholder = "请先选择样品种类";
            this.formObjText1[10].placeholder = "请先选择样品种类";
            this.formObjText_zj4[10].placeholder = "请先选择样品种类";
            this.formObjText_zj6[9].placeholder = "请先选择样品种类";
            this.formObjText_zj7[10].placeholder = "请先选择样品种类";
            this.formObjText_zj8[9].placeholder = "请先选择样品种类";


            // this.formData.fAddress = "";//取样地点
            // this.formData.fDeputynum = "";//代表数量
            // this.formData.fSamplespecs = "";//规格型号
            // this.formData.fPlace = "";//产地
            // this.formData.fSampleno = "";//生产批号  沥青标号  出厂编号
            // this.formData.fManufacturer = "";//生产厂家
            // this.formData.fProductiondate = "";//制件日期  生产日期
            this.formData.fSamplenum = ""; //外加剂掺量
            this.formData.fStrengthgrade = ""; //品种等级 品种强度等级 强度等级
            this.formData.fDiameter = ""; //钢筋直径
            this.formData.fSpecimenage = ""; //养护龄期
            this.formData.SpecimenageList = []; //养护龄期
            this.formData.fSpecimensize = ""; //试件尺寸
            this.formData.fSampletestpiece = ""; //试件编号
            this.formData.fTesttype = ""; //沥青种类  钢筋种类 混凝土种类  砂浆种类 钢筋种类
            this.formData.fMixingmethod = ""; //搅拌方式
            this.formData.fWarecondition = ""; //养护条件
            this.formData.fTestlayer = ""; //试验层位
            this.formData.fGradationtype = ""; //级配类型

            this.formData.fSampletype = ""; //样品种类id 隐藏
            this.formData.fSampletypename = ""; //样品种类汉字
            this.formData.fSamplemodel = ""; //样品编码

            this.formData.fEntryledgerid = ""; //材料进场编号id 隐藏
            this.formData.fEntrynumber = ""; //材料进场编号
            this.formData.fMaterialtypeid = ""; //材料进场材料种类id
            // this.formData.fBusinessscopename = ""; //取样标段
            this.formData.fApproachdates = ""; //进场日期

            if (this.statusNum == 1) {
                if (num == 1) {
                    this.formObj = this.formObjText;
                } else {
                    this.formObj = this.formObjText_zj;
                }
            } else if (this.statusNum == 2) {
                this.getOldValue({
                    fId: this.currentDetail.fId
                }, num) //取样
            }
            this.getfSampletypeFun();
            return num;
        },

        // 改变取样日期，修改取样编号
        getEntrynumber(data) {
            var fId = "";
            if (this.statusNum == 2) {
                fId = this.currentDetail.fId
            }
            var list = {
                fSampledates: data,
                fProjectid: this.userInfo.projectId, //当前登录人项目id
                fCompanyid: this.userInfo.companyId, //当前登录人机构id
                fId: fId, //当前数据id
                fNature: this.userInfo.companyNature,
            }
            getSampleWorkDateByAdd(list)
                .then((res) => {
                    if (res.errcode == 0) {
                        this.formData.fSamplenostr = res.data.fSamplenostr;
                    } else {
                        this.$message.error(res.msg);
                        return false;
                    }
                })
                .catch(() => {
                    console.log("获取取样编号接口报错");
                });
        },
        // 时间
        getData() {
            var time = new Date();
            const y = time.getFullYear();
            const m = (time.getMonth() + 1 + "").padStart(2, "0");
            const d = (time.getDate() + "").padStart(2, "0");
            const hh = (time.getHours() + "").padStart(2, "0");
            const mm = (time.getMinutes() + "").padStart(2, "0");
            const ss = (time.getSeconds() + "").padStart(2, "0");
            this.timeYMD = `${y}-${m}-${d}`;
            this.timeYmdHms = `${y}-${m}-${d} ${hh}:${mm}:${ss}`;
        },

        // 调标段
        getBusinessscopename() {
            var treeText = {
                companyId: this.userInfo.companyId,
                userId: this.userInfo.userId,
            };
            getUserCompanyTreeList(treeText)
                .then((res) => {
                    if (res.errcode == 0) {
                        var BusinessscopenameMap = [];
                        res.data.userCompanyTreeList.map(item => {
                            if (item.fCompanyid != this.userInfo.companyId) {
                                BusinessscopenameMap.push({
                                    label: item.fShortname,
                                    value: item.fCompanyid,
                                })
                            }
                        });
                        this.formObjText[6].options = BusinessscopenameMap;
                        this.formObjText1[6].options = BusinessscopenameMap;
                        this.formObjText_zj[5].options = BusinessscopenameMap;
                        this.formObjText_zj1[5].options = BusinessscopenameMap;
                        this.formObjText_zj2[5].options = BusinessscopenameMap;
                        this.formObjText_zj3[5].options = BusinessscopenameMap;
                        this.formObjText_zj4[5].options = BusinessscopenameMap;
                        this.formObjText_zj5[5].options = BusinessscopenameMap;
                        this.formObjText_zj6[5].options = BusinessscopenameMap;
                        this.formObjText_zj7[5].options = BusinessscopenameMap;
                        this.formObjText_zj8[5].options = BusinessscopenameMap;
                        this.formObjText_zj9[5].options = BusinessscopenameMap;
                        this.formObjText_zj10[5].options = BusinessscopenameMap;
                        this.formObjText_zj11[5].options = BusinessscopenameMap;
                        this.formObjText_zj12[5].options = BusinessscopenameMap;
                        this.formObjText_zj13[5].options = BusinessscopenameMap;
                        this.formObjText_zj14[5].options = BusinessscopenameMap;
                        this.formObjText_zj15[5].options = BusinessscopenameMap;
                        this.formObjText_zj16[5].options = BusinessscopenameMap;
                        this.formObjText_zj17[5].options = BusinessscopenameMap;
                        this.formObjText_zj18[5].options = BusinessscopenameMap;

                    } else {
                        this.$message.error(res.msg);
                        return false;
                    }
                })
                .catch(() => {
                    console.log("左侧树结构接口报错");
                });
        },
        // WBS
        refreshList() { },
        WBSDialog() { // WBS树关闭
            this.WBSShow = false;
        },
        getWBS(data) { //获取选择WBS信息
            // console.log(data);
            var name = [];
            var id = [];
            var fLongids = []
            data.map(item => {
                name.push(item.fLongname)
                id.push(item.fNodeid)
                fLongids.push(item.fLongids)
            })
            this.formData.fProjectlocation = name.join(','); //工程部位
            this.formData.fProjectlocationid = id.join(','); //工程部位id
            this.formData.fLocationid = fLongids.join(','); //工程部位id

            // console.log(this.formData.fProjectlocation,this.formData.fProjectlocationid);
        },
        // WBS

        // 材料进场编号
        // 左侧树结构
        getTree(text) {
            this.treeText = {
                companyId: this.userInfo.companyId,
                userId: this.userInfo.userId,
                // text: "4", // 0其他  1 砼拌合站 2水稳 3沥青 4张拉压浆
            };
            getUserCompanyTreeList(this.treeText)
                .then((res) => {
                    if (res.errcode == 0) {
                        var companyTree = res.data.userCompanyTreeList;
                        this.treeData = this.commonJs.tranListToTreeData(companyTree);
                        if (text == "fEntrynumber") {
                            if (this.treeData[0].children == undefined) {
                                this.treelength = false; //左侧组织机构是否显示
                            } else {
                                this.treelength = true;
                            }
                            this.checkData[0] = this.treeData[0].fCompanyid;
                            this.getList_cl.fCompanyid = this.treeData[0].fCompanyid; //当前点击组织机构ID
                            this.yj_searchForm_cl(this.getList_cl); // 调用主页面列表接口
                        }
                    } else {
                        this.$message.error(res.msg);
                        // this.$message.error("获取组织机构失败");
                        return false;
                    }
                })
                .catch(() => {
                    console.log("左侧树结构接口报错");
                });
        },
        // 点击左侧机构树
        handleNodeClickTree(data) {
            this.getList_cl.fCompanyid = data.fCompanyid;
            this.yj_searchForm_cl(this.getList_cl);
        },
        // 列表
        yj_searchForm_cl(data) {
            this.getList_cl.isTestNum = "是";
            this.loadingEditDialog_cl = true;
            getEntryledgerPageLists(data)
                .then((res) => {
                    if (res.errcode == 0) {
                        this.loadingEditDialog_cl = false;
                        this.dialogEditVisible_cl = true;
                        this.tableData_cl = res.data.pageInfo.list;
                        this.queryCriteriaData_cl = res.data.pageInfo;
                        this.navigatepageNums_cl =
                            this.queryCriteriaData_cl.navigatepageNums_cl.length;
                    } else {
                        this.$message.error(res.msg);
                        this.loadingEditDialog_cl = false;
                    }
                })
                .catch((error) => {
                    console.log("列表数据 接口出错", error.msg);
                    this.loadingEditDialog_cl = false;
                });
        },
        // 点击当前
        rowChange_cl(val) {
            this.rowInfo_cl = val;
        },
        // 点击查看
        yj_viewForm_cl(row, label) {
            console.log(row);
            this.rowInfo_cl = row;
            return label;
        },
        // 保存
        yj_saveForm_cl() {
            if (this.rowInfo_cl.fEntrynumber != this.formData.fEntrynumber) {
                this.formData.fSampletype = ""; //样品种类id 隐藏
                this.formData.fSampletypename = ""; //样品种类汉字
                this.formData.fSamplemodel = ""; //样品编码
            }
            this.dialogEditVisible_cl = false;
            this.formData.fEntryledgerid = this.rowInfo_cl.fId; //材料进场编号id 隐藏
            this.formData.fEntrynumber = this.rowInfo_cl.fEntrynumber; //材料进场编号
            this.formData.fMaterialtypeid = this.rowInfo_cl.fMaterialtypeid; //材料进场材料种类id
            this.formData.fSamplespecs = this.rowInfo_cl.fSpecification; //规格型号
            this.formData.fBusinessscopename = this.rowInfo_cl.fCompanyname; //取样标段
            this.formData.fBusinessscopecompanyid = this.rowInfo_cl.fCompanyid;
            this.formData.fSampleno = this.rowInfo_cl.fBatchnumber; //批号/编号
            this.formData.fManufacturer = this.rowInfo_cl.fManufacturername; //生产厂家
            this.formData.fApproachdates = this.rowInfo_cl.fEntrydates; //进场日期

            if (
                this.formData.fEntrynumber != "" ||
                this.formData.fEntrynumber != null
            ) {
                this.formObjText[5].disabled = true;
                this.formObjText[7].disabled = true;
                this.formObjText[10].disabled = true;
                this.formObjText[16].disabled = true;

            } else {
                this.formObjText[5].disabled = false;
                this.formObjText[7].disabled = false;
                this.formObjText[10].disabled = false;
                this.formObjText[16].disabled = false;
            }

            this.getfSampletypeFun();
        },
        // 材料进场编号

        // 获取样品种类
        getfSampletypeFun() {
            var data = {
                fChecktypenum: this.formData.fChecktypenum, //0自检1外委
                fMaterialtypeid: this.formData.fMaterialtypeid, //材料进场材料种类id
            };
            getfSampletype(data)
                .then((res) => {
                    if (res.errcode == 0) {
                        this.fSampletypeList = this.tranListToTreeData(
                            res.data.SampletypeList
                        );
                        // 外委取样
                        this.formObjText[3].tree.treeData = this.fSampletypeList;
                        this.formObjText[3].tree.checkData = [
                            this.fSampletypeList[0].fSampletype,
                        ];
                        this.formObjText1[3].tree.treeData = this.fSampletypeList;
                        this.formObjText1[3].tree.checkData = [
                            this.fSampletypeList[0].fSampletype,
                        ];
                        // 外委取样


                        // 自检取样
                        // 原值
                        this.formObjText_zj[3].tree.treeData = this.fSampletypeList;
                        this.formObjText_zj[3].tree.checkData = [
                            this.fSampletypeList[0].fSampletype,
                        ];
                        // 土
                        this.formObjText_zj1[3].tree.treeData = this.fSampletypeList;
                        this.formObjText_zj1[3].tree.checkData = [
                            this.fSampletypeList[0].fSampletype,
                        ];
                        // 粗集料/细集料/岩石
                        this.formObjText_zj2[3].tree.treeData = this.fSampletypeList;
                        this.formObjText_zj2[3].tree.checkData = [
                            this.fSampletypeList[0].fSampletype,
                        ];
                        // 矿粉
                        this.formObjText_zj3[3].tree.treeData = this.fSampletypeList;
                        this.formObjText_zj3[3].tree.checkData = [
                            this.fSampletypeList[0].fSampletype,
                        ];
                        // 水泥
                        this.formObjText_zj4[3].tree.treeData = this.fSampletypeList;
                        this.formObjText_zj4[3].tree.checkData = [
                            this.fSampletypeList[0].fSampletype,
                        ];
                        // 水
                        this.formObjText_zj5[3].tree.treeData = this.fSampletypeList;
                        this.formObjText_zj5[3].tree.checkData = [
                            this.fSampletypeList[0].fSampletype,
                        ];
                        // 外加剂
                        this.formObjText_zj6[3].tree.treeData = this.fSampletypeList;
                        this.formObjText_zj6[3].tree.checkData = [
                            this.fSampletypeList[0].fSampletype,
                        ];
                        // 石灰
                        this.formObjText_zj7[3].tree.treeData = this.fSampletypeList;
                        this.formObjText_zj7[3].tree.checkData = [
                            this.fSampletypeList[0].fSampletype,
                        ];
                        // 粉煤灰
                        this.formObjText_zj8[3].tree.treeData = this.fSampletypeList;
                        this.formObjText_zj8[3].tree.checkData = [
                            this.fSampletypeList[0].fSampletype,
                        ];
                        // 普通沥青
                        this.formObjText_zj9[3].tree.treeData = this.fSampletypeList;
                        this.formObjText_zj9[3].tree.checkData = [
                            this.fSampletypeList[0].fSampletype,
                        ];
                        // 钢筋原材
                        this.formObjText_zj10[3].tree.treeData = this.fSampletypeList;
                        this.formObjText_zj10[3].tree.checkData = [
                            this.fSampletypeList[0].fSampletype,
                        ];
                        // 水泥混凝土拌合物
                        this.formObjText_zj11[3].tree.treeData = this.fSampletypeList;
                        this.formObjText_zj11[3].tree.checkData = [
                            this.fSampletypeList[0].fSampletype,
                        ];
                        // 硬化后水泥混凝
                        this.formObjText_zj12[3].tree.treeData = this.fSampletypeList;
                        this.formObjText_zj12[3].tree.checkData = [
                            this.fSampletypeList[0].fSampletype,
                        ];
                        // 水泥砂浆拌合物
                        this.formObjText_zj13[3].tree.treeData = this.fSampletypeList;
                        this.formObjText_zj13[3].tree.checkData = [
                            this.fSampletypeList[0].fSampletype,
                        ];
                        // 硬化后水泥砂浆
                        this.formObjText_zj14[3].tree.treeData = this.fSampletypeList;
                        this.formObjText_zj14[3].tree.checkData = [
                            this.fSampletypeList[0].fSampletype,
                        ];
                        // 硬化后水泥净浆
                        this.formObjText_zj15[3].tree.treeData = this.fSampletypeList;
                        this.formObjText_zj15[3].tree.checkData = [
                            this.fSampletypeList[0].fSampletype,
                        ];
                        // 沥青混合料
                        this.formObjText_zj16[3].tree.treeData = this.fSampletypeList;
                        this.formObjText_zj16[3].tree.checkData = [
                            this.fSampletypeList[0].fSampletype,
                        ];
                        // 水泥混凝土抗弯拉、水泥抗折抗压强度
                        this.formObjText_zj17[3].tree.treeData = this.fSampletypeList;
                        this.formObjText_zj17[3].tree.checkData = [
                            this.fSampletypeList[0].fSampletype,
                        ];
                        // 钢筋焊接、钢筋机械连接
                        this.formObjText_zj18[3].tree.treeData = this.fSampletypeList;
                        this.formObjText_zj18[3].tree.checkData = [
                            this.fSampletypeList[0].fSampletype,
                        ];
                        // 自检取样
                    } else {
                        this.$message.error(res.msg);
                        this.loadingEditDialog_cl = false;
                    }
                })
                .catch((error) => {
                    console.log("获取样品种类 接口出错", error.msg);
                    this.loadingEditDialog_cl = false;
                });
        },
        tranListToTreeData(data) {
            let result = [];
            if (!Array.isArray(data)) {
                return result;
            }
            // 清除已存在的数据  重新赋值
            data.forEach((item) => {
                delete item.children;
            });

            let map = {};
            data.forEach((item) => {
                map[item.fSampletype] = item;
            });

            data.forEach((item) => {
                let parent = map[item.fParentId];
                if (parent) {
                    (parent.children || (parent.children = [])).push(item);
                } else {
                    result.push(item);
                }
            });
            return result;
        },
        //生产厂家List
        getPurveyorData(id) {
            var data = {
                page: 1,
                pageSize: 500,
                merchantName: "", //生产厂家
                fVarietyid: id, //种类ID
                typ: "1", //"1"材料生产商，"2"材料供应商
            };
            getPurveyorDataList(data)
                .then((res) => {
                    if (res.errcode == 0) {
                        this.formObjText[10].placeholder = "请选择厂家";
                        this.formObjText1[10].placeholder = "请选择厂家";
                        this.formObjText_zj4[10].placeholder = "请选择厂家";
                        this.formObjText_zj6[9].placeholder = "请选择厂家";
                        this.formObjText_zj7[10].placeholder = "请选择厂家";
                        this.formObjText_zj8[9].placeholder = "请选择厂家";

                        this.formObjText[10].options = [];
                        this.formObjText1[10].options = [];
                        this.formObjText_zj4[10].options = [];
                        this.formObjText_zj6[9].options = [];
                        this.formObjText_zj7[10].options = [];
                        this.formObjText_zj8[9].options = [];
                        res.data.pageInfo.list.map((item) => {
                            this.formObjText[10].options.push({
                                value: item.fMerchantname,
                                label: item.fMerchantname,
                            });
                            this.formObjText1[10].options.push({
                                value: item.fMerchantname,
                                label: item.fMerchantname,
                            });
                            this.formObjText_zj4[10].options.push({
                                value: item.fMerchantname,
                                label: item.fMerchantname,
                            });
                            this.formObjText_zj6[9].options.push({
                                value: item.fMerchantname,
                                label: item.fMerchantname,
                            });
                            this.formObjText_zj7[10].options.push({
                                value: item.fMerchantname,
                                label: item.fMerchantname,
                            });
                            this.formObjText_zj8[9].options.push({
                                value: item.fMerchantname,
                                label: item.fMerchantname,
                            });
                            this.formObjText_zj10[10].options.push({
                                value: item.fMerchantname,
                                label: item.fMerchantname,
                            });
                            this.formObjText_zj18[10].options.push({
                                value: item.fMerchantname,
                                label: item.fMerchantname,
                            });
                        });
                    } else {
                        this.$message.error(res.msg);
                    }
                })
                .catch((error) => {
                    console.log("获取生产厂家 接口出错", error.msg);
                });
        },
        // 字典项
        getDictionaryCode(data) {

            getBaseDataitemDetailByItemCode({
                fItemcode: data
            })
                .then((res) => {
                    if (res.errcode == 0) {
                        if (data == "Speci1" || data == "Speci2" || data == "Speci3") {
                            // 规格型号
                            this.formObjText_zj2[10].options = [];
                            res.data.baseDataitemdetailList.map((item) => {
                                this.formObjText_zj2[10].options.push({
                                    value: item.fItemname,
                                    label: item.fItemvalue,
                                });
                            });
                            if (this.formData.fChecktypenum == "1") {
                                this.formObjText1[5].options = [];
                                res.data.baseDataitemdetailList.map((item) => {
                                    this.formObjText1[5].options.push({
                                        value: item.fItemname,
                                        label: item.fItemvalue,
                                    });
                                });
                            }
                        } else if (data == "Variety1") {
                            //品种等级
                            this.formObjText_zj7[11].options = [];
                            res.data.baseDataitemdetailList.map((item) => {
                                this.formObjText_zj7[11].options.push({
                                    value: item.fItemname,
                                    label: item.fItemvalue,
                                });
                            });
                        } else if (data == "Grade1") {
                            //沥青标号
                            this.formObjText_zj9[10].options = [];
                            res.data.baseDataitemdetailList.map((item) => {
                                this.formObjText_zj9[10].options.push({
                                    value: item.fItemname,
                                    label: item.fItemvalue,
                                });
                            });
                        } else if (data == "Diameter") {
                            //钢筋直径
                            this.formObjText_zj10[12].options = [];
                            res.data.baseDataitemdetailList.map((item) => {
                                this.formObjText_zj10[12].options.push({
                                    value: item.fItemname,
                                    label: item.fItemvalue,
                                });
                            });
                            this.formObjText_zj18[12].options = [];
                            res.data.baseDataitemdetailList.map((item) => {
                                this.formObjText_zj18[12].options.push({
                                    value: item.fItemname,
                                    label: item.fItemvalue,
                                });
                            });
                        } else if (data == "Brand") {
                            // 钢筋种类
                            this.formObjText_zj10[13].options = [];
                            res.data.baseDataitemdetailList.map((item) => {
                                this.formObjText_zj10[13].options.push({
                                    value: item.fItemname,
                                    label: item.fItemvalue,
                                });
                            });
                            this.formObjText_zj18[13].options = [];
                            res.data.baseDataitemdetailList.map((item) => {
                                this.formObjText_zj18[13].options.push({
                                    value: item.fItemname,
                                    label: item.fItemvalue,
                                });
                            });
                            if (this.formData.fChecktypenum == "1") {
                                this.formObjText1[5].options = [];
                                res.data.baseDataitemdetailList.map((item) => {
                                    this.formObjText1[5].options.push({
                                        value: item.fItemname,
                                        label: item.fItemvalue,
                                    });
                                });
                            }
                        } else if (data == "SpecimenAge1") {
                            // 养护龄期
                            this.formObjText_zj12[13].options = [];
                            res.data.baseDataitemdetailList.map((item) => {
                                this.formObjText_zj12[13].options.push({
                                    value: item.fItemname,
                                    label: item.fItemvalue,
                                });
                            });
                        } else if (data == "SpecimenAge3") {
                            // 养护龄期
                            this.formObjText_zj14[13].options = [];
                            res.data.baseDataitemdetailList.map((item) => {
                                this.formObjText_zj14[13].options.push({
                                    value: item.fItemname,
                                    label: item.fItemvalue,
                                });
                            });
                        } else if (data == "StrengthGrade1") {
                            //强度等级
                            this.formObjText_zj11[8].options = [];
                            res.data.baseDataitemdetailList.map((item) => {
                                this.formObjText_zj11[8].options.push({
                                    value: item.fItemname,
                                    label: item.fItemvalue,
                                });
                            });

                            this.formObjText_zj12[8].options = [];
                            res.data.baseDataitemdetailList.map((item) => {
                                this.formObjText_zj12[8].options.push({
                                    value: item.fItemname,
                                    label: item.fItemvalue,
                                });
                            });
                        } else if (data == "StrengthGrade3") {
                            //强度等级
                            this.formObjText_zj14[8].options = [];
                            res.data.baseDataitemdetailList.map((item) => {
                                this.formObjText_zj14[8].options.push({
                                    value: item.fItemname,
                                    label: item.fItemvalue,
                                });
                            });
                        } else if (data == "StrengthGrade4") {
                            console.log('字典项', data);
                            //强度等级
                            this.formObjText_zj15[11].options = [];
                            res.data.baseDataitemdetailList.map((item) => {
                                this.formObjText_zj15[11].options.push({
                                    value: item.fItemname,
                                    label: item.fItemvalue,
                                });
                            });
                        } else if (data == "SpecimenSize1") {
                            //试件尺寸
                            this.formObjText_zj12[14].options = [];
                            res.data.baseDataitemdetailList.map((item) => {
                                this.formObjText_zj12[14].options.push({
                                    value: item.fItemname,
                                    label: item.fItemvalue,
                                });
                            });
                        } else if (data == "SpecimenSize3") {
                            //试件尺寸
                            this.formObjText_zj14[14].options = [];
                            res.data.baseDataitemdetailList.map((item) => {
                                this.formObjText_zj14[14].options.push({
                                    value: item.fItemname,
                                    label: item.fItemvalue,
                                });
                            });
                        } else if (data == "Hnttype1") {
                            //混凝土种类
                            this.formObjText_zj11[9].options = [];
                            res.data.baseDataitemdetailList.map((item) => {
                                this.formObjText_zj11[9].options.push({
                                    value: item.fItemname,
                                    label: item.fItemvalue,
                                });
                            });

                            this.formObjText_zj12[9].options = [];
                            res.data.baseDataitemdetailList.map((item) => {
                                this.formObjText_zj12[9].options.push({
                                    value: item.fItemname,
                                    label: item.fItemvalue,
                                });
                            });
                        } else if (data == "StirringMethod1") {
                            //搅拌方式
                            this.formObjText_zj11[10].options = [];
                            res.data.baseDataitemdetailList.map((item) => {
                                this.formObjText_zj11[10].options.push({
                                    value: item.fItemname,
                                    label: item.fItemvalue,
                                });
                            });

                            this.formObjText_zj12[10].options = [];
                            res.data.baseDataitemdetailList.map((item) => {
                                this.formObjText_zj12[10].options.push({
                                    value: item.fItemname,
                                    label: item.fItemvalue,
                                });
                            });

                            this.formObjText_zj13[10].options = [];
                            res.data.baseDataitemdetailList.map((item) => {
                                this.formObjText_zj13[10].options.push({
                                    value: item.fItemname,
                                    label: item.fItemvalue,
                                });
                            });
                            this.formObjText_zj14[10].options = [];
                            res.data.baseDataitemdetailList.map((item) => {
                                this.formObjText_zj14[10].options.push({
                                    value: item.fItemname,
                                    label: item.fItemvalue,
                                });
                            });
                            this.formObjText_zj15[8].options = [];
                            res.data.baseDataitemdetailList.map((item) => {
                                this.formObjText_zj15[8].options.push({
                                    value: item.fItemname,
                                    label: item.fItemvalue,
                                });
                            });
                        } else if (data == "CuringCondition") {
                            //养护条件
                            this.formObjText_zj12[11].options = [];
                            res.data.baseDataitemdetailList.map((item) => {
                                this.formObjText_zj12[11].options.push({
                                    value: item.fItemname,
                                    label: item.fItemvalue,
                                });
                            });
                            this.formObjText_zj14[11].options = [];
                            res.data.baseDataitemdetailList.map((item) => {
                                this.formObjText_zj14[11].options.push({
                                    value: item.fItemname,
                                    label: item.fItemvalue,
                                });
                            });
                            this.formObjText_zj15[9].options = [];
                            res.data.baseDataitemdetailList.map((item) => {
                                this.formObjText_zj15[9].options.push({
                                    value: item.fItemname,
                                    label: item.fItemvalue,
                                });
                            });
                        }

                    } else {
                        this.$message.error(res.msg);
                    }
                })
                .catch(() => {
                    console.log("字典--强度等级接口报错");
                });
        },
        // 取样新增
        addition(num) {
            this.recordfiles = [];
            this.loading = true;
            var src = {
                fProjectid: this.userInfo.projectId, //当前登录人项目id
                fCompanyid: this.userInfo.companyId, //当前登录人机构id
                fNature: this.userInfo.companyNature,
            };
            getSampleWorkByAdd(src)
                .then((res) => {
                    if (res.errcode == 0) {
                        var that = this;
                        that.loading = false;
                        if (num == 0) {//新增初进入
                            that.formData = res.data.lrCheckSample;
                            that.formData.userId = that.userInfo.userId; //当前登录人id
                            that.formData.userName = that.userInfo.realName; //当前登录人姓名
                            // that.formData.fCompanyid = that.userInfo.companyId; //施工单位id 隐藏
                            // that.formData.fCompanyname = that.userInfo.companyName; //施工单位名称 隐藏
                            that.formData.fProjectid = that.userInfo.projectId; //项目id 隐藏
                            that.formData.fProjectname = that.userInfo.projectName; //项目名称 隐藏
                            that.formData.fChecktypenum = "0"; //项目名称 隐藏
                            that.formData.fSampleperson = that.userInfo.realName; //取样人
                            that.formData.fSamplepersonid = that.userInfo.userId; //取样人id
                            if (that.userInfo.companyNature == "施工单位") {
                                that.formData.fBusinessscopename = that.userInfo.companyName; //取样标段
                                that.formData.fBusinessscopecompanyid = that.userInfo.companyId;
                            } else {
                                that.getBusinessscopename();
                            }
                            that.getfSampletypeFun(); //样品种类
                            // that.getPurveyorData(); //生产厂家
                        } else if (num == 1) {
                            that.formData.fSamplenostr = res.data.lrCheckSample.fSamplenostr;
                        }


                    } else {
                        this.loading = false;
                        this.$message.error(res.errcode, res.msg);
                    }
                })
                .catch(() => {
                    console.log("预新增接口报错");
                });
        },
        // 详情
        getDetail(obj) {
            //切换是否展示  2取样&收样；0取样；1收样
            if (this.displaySwitching == 0) {
                this.getSampleWork(obj); // 取样详情
            } else if (this.displaySwitching == 1) {
                this.getSampleWorkTest(obj); //收样详情
            } else {
                this.getSampleWork(obj); // 取样详情
                this.getSampleWorkTest(obj); //收样详情
            }
        },
        // 取样详情
        getSampleWork(obj) {
            this.loading = true;
            this.recordfiles = [];
            getSampleWorkByFid(obj)
                .then((res) => {
                    if (res.errcode == 0) {
                        var that = this;
                        that.loading = false;
                        that.formData = res.data.lrCheckSample;
                        that.fileList = res.data.fPhotofileList; //取样现场照片
                        that.fSourcefileList = res.data.fSourcefileList; //现场取样视频
                        if (that.statusNum == 2) { // 编辑
                            that.formData.fSampleperson = that.userInfo.realName; //取样人
                            that.formData.fSamplepersonid = that.userInfo.userId; //取样人id
                            that.formData.userId = that.userInfo.userId; //当前登录人id
                            that.formData.userName = that.userInfo.realName; //当前登录人姓名
                            // that.formData.fCompanyid = that.userInfo.companyId; //施工单位id 隐藏
                            // that.formData.fCompanyname = that.userInfo.companyName; //施工单位名称 隐藏
                            that.formData.fProjectid = that.userInfo.projectId; //项目id 隐藏
                            that.formData.fProjectname = that.userInfo.projectName; //项目名称 隐藏
                            that.getfSampletypeFun(); //样品种类
                            that.getPurveyorData(that.formData.fVarietyid); //生产厂家
                            //取样标段
                            if (that.userInfo.companyNature == "施工单位") {
                                if (that.formData.fBusinessscopename == null || that.formData.fBusinessscopename == "") {
                                    that.formData.fBusinessscopename = that.userInfo.companyName;
                                }
                            } else {
                                that.getBusinessscopename();
                            }
                            if (that.formData.fSampletypename == "硬化后水泥混凝土") {
                                this.getSampleHistoryList({
                                    fCompanyid: this.userInfo.companyId, // 当前数据组织机构id
                                    sampleType: that.formData.fSampletype // "fSampletype": "样品种类"
                                }, 1)
                            } else {
                                this.getSampleHistoryList({
                                    fCompanyid: this.userInfo.companyId, // 当前数据组织机构id
                                    sampleType: that.formData.fSampletype // "fSampletype": "样品种类"
                                }, 0)
                            }
                            // 表单展示
                            if (that.formData.fChecktypenum == "1") {
                                if (that.formData.fSampletypename == "粗集料" || that.formData.fSampletypename == "细集料" || that.formData.fSampletypename == "钢筋原材") {
                                    that.formObj = that.formObjText1;
                                    if (that.formData.fSampletypename == "粗集料") {
                                        that.getDictionaryCode("Speci1");
                                    } else if (that.formData.fSampletypename == "细集料") {
                                        that.getDictionaryCode("Speci2");
                                    } else if (that.formData.fSampletypename == "钢筋原材") {
                                        that.getDictionaryCode("Brand");
                                    }
                                } else {
                                    that.formObj = that.formObjText;
                                }
                            } else if (that.formData.fChecktypenum == "0") {
                                if (that.formData.fSampletypename == "土") {
                                    that.formObj = that.formObjText_zj1;
                                } else if (that.formData.fSampletypename == "粗集料" || that.formData.fSampletypename == "细集料" || that.formData.fSampletypename == "岩石") {
                                    that.formObj = that.formObjText_zj2;
                                    if (that.formData.fSampletypename == "粗集料") {
                                        that.getDictionaryCode("Speci1");
                                    } else if (that.formData.fSampletypename == "细集料") {
                                        that.getDictionaryCode("Speci2");
                                    } else if (that.formData.fSampletypename == "岩石") {
                                        that.getDictionaryCode("Speci3");
                                    }
                                } else if (that.formData.fSampletypename == "矿粉") {
                                    that.formObj = that.formObjText_zj3;
                                } else if (that.formData.fSampletypename == "水泥") {
                                    that.formObj = that.formObjText_zj4;
                                } else if (that.formData.fSampletypename == "水") {
                                    that.formObj = that.formObjText_zj5;
                                } else if (that.formData.fSampletypename == "外加剂") {
                                    that.formObj = that.formObjText_zj6;
                                } else if (that.formData.fSampletypename == "石灰") {
                                    that.formObj = that.formObjText_zj7;
                                    that.getDictionaryCode("Variety1");
                                } else if (that.formData.fSampletypename == "粉煤灰") {
                                    that.formObj = that.formObjText_zj8;
                                } else if (that.formData.fSampletypename == "普通沥青") {
                                    that.formObj = that.formObjText_zj9;
                                    that.getDictionaryCode("Grade1");
                                } else if (that.formData.fSampletypename == "钢筋原材") {
                                    that.formObj = that.formObjText_zj10;
                                    that.getDictionaryCode("Diameter");
                                    that.getDictionaryCode("Brand");
                                } else if (that.formData.fSampletypename == "水泥混凝土拌合物") {
                                    that.formObj = that.formObjText_zj11;
                                    that.getDictionaryCode("StrengthGrade1");
                                    that.getDictionaryCode("Hnttype1");
                                    that.getDictionaryCode("StirringMethod1");
                                } else if (that.formData.fSampletypename == "硬化后水泥混凝土") {
                                    that.formObj = that.formObjText_zj12;
                                    that.getDictionaryCode("StrengthGrade1");
                                    that.getDictionaryCode("Hnttype1");
                                    that.getDictionaryCode("StirringMethod1");
                                    that.getDictionaryCode("CuringCondition");
                                    that.getDictionaryCode("SpecimenAge1");
                                    that.getDictionaryCode("SpecimenSize1");
                                } else if (that.formData.fSampletypename == "水泥砂浆拌合物") {
                                    that.formObj = that.formObjText_zj13;
                                    that.getDictionaryCode("StirringMethod1");
                                } else if (that.formData.fSampletypename == "硬化后水泥砂浆") {
                                    that.formObj = that.formObjText_zj14;
                                    that.getDictionaryCode("StrengthGrade3");
                                    that.getDictionaryCode("StirringMethod1");
                                    that.getDictionaryCode("CuringCondition");
                                    that.getDictionaryCode("SpecimenAge3");
                                    that.getDictionaryCode("SpecimenSize3");
                                } else if (that.formData.fSampletypename == "硬化后水泥净浆") {
                                    that.formObj = that.formObjText_zj15;
                                    that.getDictionaryCode("StirringMethod1");
                                    that.getDictionaryCode("StrengthGrade4");
                                    that.getDictionaryCode("CuringCondition");
                                } else if (that.formData.fSampletypename == "沥青混合料") {
                                    that.formObj = that.formObjText_zj16;
                                } else if (that.formData.fSampletypename == "水泥混凝土抗弯拉" || that.formData.fSampletypename == "水泥抗折抗压强度") {
                                    that.formObj = that.formObjText_zj17;
                                } else if (that.formData.fSampletypename == "钢筋焊接" || that.formData.fSampletypename == "钢筋机械连接") {
                                    that.formObj = that.formObjText_zj18;
                                    that.getDictionaryCode("Diameter");
                                    that.getDictionaryCode("Brand");
                                } else {
                                    that.formObj = that.formObjText_zj;
                                }
                            }
                            // 表单展示

                            // //龄期
                            // if (that.formData.fSpecimenage == "" || that.formData.fSpecimenage == null) {
                            //     that.formData.SpecimenageList = [];
                            // } else {
                            //     that.formData.SpecimenageList = [];
                            //     var SpecimenageArr = that.formData.fSpecimenage.split(",");
                            //     SpecimenageArr.map((item) => {
                            //         that.formData.SpecimenageList.push({
                            //             value: item,
                            //             label: item,
                            //         });
                            //     });
                            // }
                            // that.selected = [{
                            //     name: "SpecimenageList",
                            //     selected: that.formData.SpecimenageList,
                            // },];
                        } else {
                            if (that.formData.fChecktypenum == "1") {
                                that.formObj = that.formObjLook;
                            } else if (that.formData.fChecktypenum == "0") {
                                if (that.formData.fSampletypename == "土") {
                                    that.formObj = that.formObjLook_zj1;
                                } else if (that.formData.fSampletypename == "矿粉" || that.formData.fSampletypename == "粗集料" || that.formData.fSampletypename == "细集料" || that.formData.fSampletypename == "岩石") {
                                    that.formObj = that.formObjLook_zj2;
                                } else if (that.formData.fSampletypename == "水泥") {
                                    that.formObj = that.formObjLook_zj4;
                                } else if (that.formData.fSampletypename == "水") {
                                    that.formObj = that.formObjLook_zj5;
                                } else if (that.formData.fSampletypename == "外加剂") {
                                    that.formObj = that.formObjLook_zj6;
                                } else if (that.formData.fSampletypename == "石灰") {
                                    that.formObj = that.formObjLook_zj7;
                                } else if (that.formData.fSampletypename == "粉煤灰") {
                                    that.formObj = that.formObjLook_zj8;
                                } else if (that.formData.fSampletypename == "普通沥青") {
                                    that.formObj = that.formObjLook_zj9;
                                } else if (that.formData.fSampletypename == "钢筋原材") {
                                    that.formObj = that.formObjLook_zj10;
                                } else if (that.formData.fSampletypename == "水泥混凝土拌合物") {
                                    that.formObj = that.formObjLook_zj11;
                                } else if (that.formData.fSampletypename == "硬化后水泥混凝土") {
                                    that.formObj = that.formObjLook_zj12;
                                } else if (that.formData.fSampletypename == "水泥砂浆拌合物") {
                                    that.formObj = that.formObjLook_zj13;
                                } else if (that.formData.fSampletypename == "硬化后水泥砂浆") {
                                    that.formObj = that.formObjLook_zj14;
                                } else if (that.formData.fSampletypename == "硬化后水泥净浆") {
                                    that.formObj = that.formObjLook_zj15;
                                } else if (that.formData.fSampletypename == "沥青混合料") {
                                    that.formObj = that.formObjLook_zj16;
                                } else if (that.formData.fSampletypename == "钢筋焊接" || that.formData.fSampletypename == "钢筋机械连接") {
                                    that.formObj = that.formObjLook_zj18;
                                } else {
                                    that.formObj = that.formObjLook_zj;
                                }
                            }
                        }
                    } else {
                        this.loading = false;
                        this.$message.error(res.msg);
                    }
                })
                .catch(() => {
                    console.log("取样详情接口报错");
                });
        },
        getOldValue(obj, num) {
            getSampleWorkByFid(obj)
                .then((res) => {
                    if (res.errcode == 0) {
                        var that = this;
                        if (that.statusNum == 2) { // 编辑
                            if (that.formData.fChecktypenum == res.data.lrCheckSample.fChecktypenum) {
                                that.formData = res.data.lrCheckSample;

                                that.formData.fSampleperson = that.userInfo.realName; //取样人
                                that.formData.fSamplepersonid = that.userInfo.userId; //取样人id
                                that.formData.userId = that.userInfo.userId; //当前登录人id
                                that.formData.userName = that.userInfo.realName; //当前登录人姓名
                                // that.formData.fCompanyid = that.userInfo.companyId; //施工单位id 隐藏
                                // that.formData.fCompanyname = that.userInfo.companyName; //施工单位名称 隐藏
                                that.formData.fProjectid = that.userInfo.projectId; //项目id 隐藏
                                that.formData.fProjectname = that.userInfo.projectName; //项目名称 隐藏
                                that.getfSampletypeFun(); //样品种类
                                that.getPurveyorData(that.formData.fVarietyid); //生产厂家
                                //取样标段
                                if (that.userInfo.companyNature == "施工单位") {
                                    if (that.formData.fBusinessscopename == null || that.formData.fBusinessscopename == "") {
                                        that.formData.fBusinessscopename = that.userInfo.companyName;
                                    }
                                } else {
                                    that.getBusinessscopename();
                                }
                            }
                            if (that.formData.fSampletypename == "硬化后水泥混凝土") {
                                this.getSampleHistoryList({
                                    fCompanyid: this.userInfo.companyId, // 当前数据组织机构id
                                    sampleType: that.formData.fSampletype // "fSampletype": "样品种类"
                                }, 1)
                            } else {
                                this.getSampleHistoryList({
                                    fCompanyid: this.userInfo.companyId, // 当前数据组织机构id
                                    sampleType: that.formData.fSampletype // "fSampletype": "样品种类"
                                }, 0)
                            }

                            if (num == 1) {
                                if (that.formData.fSampletypename == "粗集料" || that.formData.fSampletypename == "细集料" || that.formData.fSampletypename == "钢筋原材") {
                                    that.formObj = this.formObjText1;
                                    if (that.formData.fSampletypename == "粗集料") {
                                        that.getDictionaryCode("Speci1");
                                    } else if (that.formData.fSampletypename == "细集料") {
                                        that.getDictionaryCode("Speci2");
                                    } else if (that.formData.fSampletypename == "钢筋原材") {
                                        that.getDictionaryCode("Brand");
                                    }
                                } else {
                                    that.formObj = that.formObjText;
                                }
                            } else {
                                if (that.formData.fSampletypename == "土") {
                                    that.formObj = that.formObjText_zj1;
                                } else if (that.formData.fSampletypename == "粗集料" || that.formData.fSampletypename == "细集料" || that.formData.fSampletypename == "岩石") {
                                    that.formObj = that.formObjText_zj2;
                                    if (that.formData.fSampletypename == "粗集料") {
                                        that.getDictionaryCode("Speci1");
                                    } else if (that.formData.fSampletypename == "细集料") {
                                        that.getDictionaryCode("Speci2");
                                    } else if (that.formData.fSampletypename == "岩石") {
                                        that.getDictionaryCode("Speci3");
                                    }
                                } else if (that.formData.fSampletypename == "矿粉") {
                                    that.formObj = that.formObjText_zj3;
                                } else if (that.formData.fSampletypename == "水泥") {
                                    that.formObj = that.formObjText_zj4;
                                } else if (that.formData.fSampletypename == "水") {
                                    that.formObj = that.formObjText_zj5;
                                } else if (that.formData.fSampletypename == "外加剂") {
                                    that.formObj = that.formObjText_zj6;
                                } else if (that.formData.fSampletypename == "石灰") {
                                    that.formObj = that.formObjText_zj7;
                                    that.getDictionaryCode("Variety1");
                                } else if (that.formData.fSampletypename == "粉煤灰") {
                                    that.formObj = that.formObjText_zj8;
                                } else if (that.formData.fSampletypename == "普通沥青") {
                                    that.formObj = that.formObjText_zj9;
                                    that.getDictionaryCode("Grade1");
                                } else if (that.formData.fSampletypename == "钢筋原材") {
                                    that.formObj = that.formObjText_zj10;
                                    that.getDictionaryCode("Diameter");
                                    that.getDictionaryCode("Brand");
                                } else if (that.formData.fSampletypename == "水泥混凝土拌合物") {
                                    that.formObj = that.formObjText_zj11;
                                    that.getDictionaryCode("StrengthGrade1");
                                    that.getDictionaryCode("Hnttype1");
                                    that.getDictionaryCode("StirringMethod1");
                                } else if (that.formData.fSampletypename == "硬化后水泥混凝土") {
                                    that.formObj = that.formObjText_zj12;
                                    that.getDictionaryCode("StrengthGrade1");
                                    that.getDictionaryCode("Hnttype1");
                                    that.getDictionaryCode("StirringMethod1");
                                    that.getDictionaryCode("CuringCondition");
                                    that.getDictionaryCode("SpecimenAge1");
                                    that.getDictionaryCode("SpecimenSize1");
                                } else if (that.formData.fSampletypename == "水泥砂浆拌合物") {
                                    that.formObj = that.formObjText_zj13;
                                    that.getDictionaryCode("StirringMethod1");
                                } else if (that.formData.fSampletypename == "硬化后水泥砂浆") {
                                    that.formObj = that.formObjText_zj14;
                                    that.getDictionaryCode("StrengthGrade3");
                                    that.getDictionaryCode("StirringMethod1");
                                    that.getDictionaryCode("CuringCondition");
                                    that.getDictionaryCode("SpecimenAge3");
                                    that.getDictionaryCode("SpecimenSize3");
                                } else if (that.formData.fSampletypename == "硬化后水泥净浆") {
                                    that.formObj = that.formObjText_zj15;
                                    that.getDictionaryCode("StirringMethod1");
                                    that.getDictionaryCode("StrengthGrade4");
                                    that.getDictionaryCode("CuringCondition");
                                } else if (that.formData.fSampletypename == "沥青混合料") {
                                    that.formObj = that.formObjText_zj16;
                                } else if (that.formData.fSampletypename == "水泥混凝土抗弯拉" || that.formData.fSampletypename == "水泥抗折抗压强度") {
                                    that.formObj = that.formObjText_zj17;
                                } else if (that.formData.fSampletypename == "钢筋焊接" || that.formData.fSampletypename == "钢筋机械连接") {
                                    that.formObj = that.formObjText_zj18;
                                    that.getDictionaryCode("Diameter");
                                    that.getDictionaryCode("Brand");
                                } else {
                                    that.formObj = that.formObjText_zj;
                                }
                            }
                        }
                    }
                })
        },


        yj_saveForm(num) {
            if (num == 0) { //取样
                // this.$refs.publicForm.validate((valid)=>{
                //     console.log(valid);
                // })

                if (this.$refs.publicForm.submitForm()) {
                    console.log('this.formData', this.formData, this.formObj);
                    // if (
                    //     this.formData.SpecimenageList != "undefined" &&
                    //     this.formData.SpecimenageList.length > 0
                    // ) {
                    //     var SpecimenageArr = "";
                    //     this.formData.SpecimenageList.map((item) => {
                    //         SpecimenageArr = SpecimenageArr + "," + item.label;
                    //     });

                    //     this.formData.fSpecimenage = SpecimenageArr.slice(
                    //         1,
                    //         SpecimenageArr.length
                    //     );
                    // } else {
                    //     this.formData.fSpecimenage = "";
                    // }
                    this.getSampleuseno(this.formData.fSamplenostr);
                } else {
                    console.log("error");
                }
            } else if (num == 1) { // 收样
                if (this.$refs.publicForm1.submitForm()) {
                    this.getPostCreateNo("sample");
                    this.getPostCreateNo("report");
                } else {
                    console.log("error");
                }
            }
        },
        // 取样编号查重
        getSampleuseno(num) {
            var data = {
                fSampleuseno: num, //试件编号
            }
            getSampleNoIsUse(data).then((res) => {
                if (res.errcode == 0) {
                    if (res.data) {
                        this.$message.warning("取样编号重复，不可保存");
                    } else {
                        this.formData.fNature = this.userInfo.companyNature;
                        this.saveForm(this.formData);
                    }
                } else {
                    this.$message.error(res.msg);
                }

            }).catch((err) => {
                console.log("取样编号查重" + err.msg);
            })

        },
        // 保存
        saveForm(data) {
            this.loading = true;
            this.isLock = true
            data.recordfiles = this.recordfiles;
            saveSampleWork(data)
                .then((res) => {
                    if (res.errcode == 0) {
                        this.loading = false;
                        this.$emit("refreshList");
                        this.isLock = false
                        this.visible = false;
                        this.$message.success("新增成功");
                    } else {
                        this.loading = false;
                        this.isLock = false
                        this.$message.error(res.msg);
                    }
                })
                .catch(() => {
                    console.log("保存接口报错");
                });
        },





        // 收样
        // 收样详情
        getSampleWorkTest(obj) {
            this.loading = true;
            getSampleWorkTestByFid(obj)
                .then((res) => {
                    if (res.errcode == 0) {
                        this.SyrjUrl = res.data.SyrjUrl; //动态请求前缀
                        var that = this;
                        this.loading = false;
                        that.formDataAccept = res.data.lrCheckSample;
                        that.TestMessage = res.data.TestMessage;
                        if (that.statusNum == 3) {
                            that.apiTokenBuild();
                            //编辑
                            if (that.formDataAccept.fSamplereportname == null) {
                                that.formDataAccept.fSamplereportname = "";
                            }
                            if (that.formDataAccept.fTestperson == null) {
                                that.formDataAccept.fTestperson = "";
                            }
                            if (that.formDataAccept.fTestnote == null) {
                                that.formDataAccept.fTestnote = "";
                            }
                            if (
                                that.formDataAccept.fCompletiondates == null ||
                                that.formDataAccept.fCompletiondates == ""
                            ) {
                                that.formDataAccept.fCompletiondates = that.timeYMD;
                            }
                            if (
                                that.formDataAccept.fCollectiondates == null ||
                                that.formDataAccept.fCollectiondates == ""
                            ) {
                                that.formDataAccept.fCollectiondates = that.timeYMD;
                            }

                            that.formDataAccept = res.data.lrCheckSample;
                            that.formObjAccept = that.formObjAcceptText;
                        } else {
                            that.formObjAccept = that.formObjAcceptLook;
                        }
                    } else {
                        this.loading = false;

                        this.$message.error(res.msg);
                    }
                })
                .catch(() => {
                    console.log("详情接口报错");
                });
        },
        // 获取Token
        async apiTokenBuild() {
            await this.$http(
                this.SyrjUrl + "cdkx/api/app/apiTokenBuild?companyId=" +
                this.TestMessage.oBaseInfo.CompanyID +
                "&projectId=" +
                this.TestMessage.oBaseInfo.ProjectID +
                "&userId=" +
                this.TestMessage.oUserId
            )
                .then((res) => {
                    if (res.data.Result == 100) {
                        this.header = {
                            accessToken: res.data.Data.Token,
                            projectId: this.TestMessage.oBaseInfo.ProjectID,
                        };
                        this.getPostTestList();
                    }
                })
                .catch((err) => {
                    console.log("获取token接口报错", err.Msg);
                });
        },
        // 获取试验名称
        getPostTestList() {
            this.formObjAcceptText[0].options = [{
                value: "==请选择==",
                label: "==请选择==",
            },];
            var data = {
                identfication: this.TestMessage.oBaseInfo.SampleIdentification, //样品标识
                organId: this.TestMessage.oBaseInfo.OrganID, //机构ID
                companyId: this.TestMessage.oBaseInfo.CompanyID, //公司ID
                testTypeId: this.TestMessage.oBaseInfo.TestTypeID, //检测项目ID
            };
            postTestList(data, this.header, this.SyrjUrl)
                .then((res) => {
                    if (res.Result == 100) {
                        this.postTestList = res.Data;
                        console.log(this.postTestList);
                        res.Data.map((item) => {
                            this.formObjAcceptText[0].options.push({
                                value: item.key,
                                label: item.key,
                            });
                        });
                    } else {
                        this.$message.error(res.Msg);
                    }
                })
                .catch(() => {
                    console.log("详情接口报错");
                });
        },
        //生成样品/报告编号--成都
        getPostCreateNo(text) {
            var data = {
                createType: text, //生成类型 （样品sample、报告report）
                organId: this.TestMessage.oBaseInfo.OrganID, //机构ID
                projectId: this.TestMessage.oBaseInfo.ProjectID, //项目ID
                companyId: this.TestMessage.oBaseInfo.CompanyID, //公司ID
                contractId: this.TestMessage.oBaseInfo.ContractID, //合同段ID
                identification: this.identification, //机构ID
                createDate: this.timeYMD, //机构ID
            };
            postCreateNo(data, this.header, this.SyrjUrl)
                .then((res) => {
                    if (res.Result == 100) {
                        if (text == "sample") {
                            this.PostSample = res.Data; //生成样品编号
                        } else {
                            this.PostReport = res.Data; //生成报告编号
                            this.getSampleSx();
                        }
                    } else {
                        this.$message.error(res.Msg);
                    }
                })
                .catch(() => {
                    console.log("详情接口报错");
                });
        },
        //获取检验对象属性
        getSampleSx() {
            var data = {
                organId: this.TestMessage.oBaseInfo.OrganID, //机构ID
                testTypeId: this.TestMessage.oBaseInfo.TestTypeID, //检测项目ID
            };
            getSampleSxList(data, this.header, this.SyrjUrl)
                .then((res) => {
                    if (res.Result == 100) {
                        this.SampleSxList = res.Data;
                        this.getRegister();
                    } else {
                        this.$message.error(res.Msg);
                    }
                })
                .catch(() => {
                    console.log("详情接口报错");
                });
        },
        //保存取样登记数据
        getRegister() {
            setTimeout(() => {
                this.SampleSxList.map((item) => {
                    if (item.key == "取样地点") {
                        item.val = this.formDataAccept.fAddress;
                    }
                    if (item.key == "工程部位/用途") {
                        item.val = this.formDataAccept.fProjectlocation;
                    }
                    if (item.key == "样品描述") {
                        item.val = this.formDataAccept.fSamplemessage;
                    }
                    if (item.key == "强度等级" || item.key == "品种强度等级" || item.key == "品种等级") {
                        item.val = this.formDataAccept.fStrengthgrade;
                    }
                    if (item.key == "搅拌方式") {
                        item.val = "人工+机械搅拌";
                    }
                    if (item.key == "试件尺寸") {
                        item.val = this.formDataAccept.fSpecimensize;
                    }
                    if (item.key == "养护条件") {
                        item.val = "标准养护";
                    }
                    if (item.key == "养护龄期") {
                        item.val = this.formDataAccept.fSpecimenage;
                    }
                    if (item.key == "制件日期" || item.key == "生产日期") {
                        item.val = this.formDataAccept.fProductiondate;
                    }
                    if (item.key == "钢筋直径") {
                        item.val = this.formDataAccept.fDiameter;
                    }
                    if (item.key == "代表数量") {
                        item.val = this.formDataAccept.fDeputynum;
                    }
                    if (item.key == "生产厂家" || item.key == "厂家(产地)") {
                        item.val = this.formDataAccept.fManufacturer;
                    }
                    if (item.key == "批号" || item.key == "出厂编号" || item.key == "生产批号" || item.key == "沥青标号") {
                        item.val = this.formDataAccept.fSampleno;
                    }
                    if (item.key == "规格型号") {
                        item.val = this.formDataAccept.fSamplespecs;
                    }
                    if (item.key == "产地") {
                        item.val = this.formDataAccept.fPlace;
                    }
                    if (item.key == "外加剂掺量") {
                        item.val = this.formDataAccept.fSamplenum;
                    }
                    if (item.key == "沥青种类" || item.key == "钢筋种类" || item.key == "混凝土种类" || item.key == "砂浆种类" || item.key == "钢筋种类" || item.key == "沥青混合料类型") {
                        item.val = this.formDataAccept.fTesttype;
                    }
                    if (item.key == "搅拌方式") {
                        item.val = this.formDataAccept.fMixingmethod;
                    }
                    if (item.key == "养护条件") {
                        item.val = this.formDataAccept.fWarecondition;
                    }
                    if (item.key == "试验层位") {
                        item.val = this.formDataAccept.fTestlayer;
                    }
                    if (item.key == "级配类型") {
                        item.val = this.formDataAccept.fGradationtype;
                    }
                });
                var data = {
                    oBaseInfo: {
                        ID: this.TestMessage.oBaseInfo.ID, //--主键ID
                        SampleName: this.TestMessage.oBaseInfo.SampleName, //--样品名称
                        Description: this.TestMessage.oBaseInfo.Description, //--样品描述
                        ProjectPartAndUse: this.TestMessage.oBaseInfo.ProjectPartAndUse, //--工程部位用途
                        ProductDate: this.TestMessage.oBaseInfo.ProductDate, //--制件日期    1
                        SampleDate: this.TestMessage.oBaseInfo.SampleDate, //--取样日期
                        // Others: null, //--检验对象属性
                        // Others: this.SampleSxList, //--检验对象属性
                        Others: JSON.stringify(this.SampleSxList), //--检验对象属性
                        Register: this.TestMessage.oBaseInfo.Register, //--取样人ID
                        RegisterNO: this.TestMessage.oBaseInfo.RegisterNO, //取样编号
                        WitnessStatus: this.TestMessage.oBaseInfo.WitnessStatus, //--见证状态传入0
                        SampleLongitude: this.TestMessage.oBaseInfo.SampleLongitude, //--取样经度
                        SampleLatitude: this.TestMessage.oBaseInfo.SampleLatitude, //--取样纬度
                        SampleLocation: this.TestMessage.oBaseInfo.SampleLocation, //--取样位置名称
                        SubItemsID: this.TestMessage.oBaseInfo.SubItemsID, //--分部分项ID
                        SubItemsNo: this.TestMessage.oBaseInfo.SubItemsNo, //--分部分项编号
                        SubItemsName: this.TestMessage.oBaseInfo.SubItemsName, //--分部分项名称
                        MaterialID: null, //--原材料ID
                        MaterialNo: null, //--原材料编号
                        TestTypeID: this.TestMessage.oBaseInfo.TestTypeID, //--样品类型ID（对应检测项目ID）
                        SampleIdentification: this.TestMessage.oBaseInfo.SampleIdentification, //--样品标识(对应样品分类值)
                        CompanyID: this.TestMessage.oBaseInfo.CompanyID, //--公司ID
                        ProjectID: this.TestMessage.oBaseInfo.ProjectID, //--项目ID
                        OrganID: this.TestMessage.oBaseInfo.OrganID, //--机构ID
                        ContractID: this.TestMessage.oBaseInfo.ContractID, //--施工标段ID
                        CreateTime: this.TestMessage.oBaseInfo.CreateTime, //--创建时间
                        TestAge: this.TestMessage.oBaseInfo.TestAge, //--龄期
                        StorageLocation: this.TestMessage.oBaseInfo.StorageLocation, //--存放位置
                    },
                    oTestList: this.TestMessage.oTestList,
                    oPhotoList: this.TestMessage.oPhotoList,
                    oAppFlow: this.TestMessage.oAppFlow, //--oAppFlow为2时，参数必传，为1时不传---默认为1 ，2取样登记后就直接生成报告编号
                    oUserId: Number(this.TestMessage.oUserId), //--oAppFlow为2时，参数必传，为1时不传---用户Id
                    oTestRoomId: this.TestMessage.oTestRoomId, //--oAppFlow为2时，参数必传，为1时不传---试验室Id
                    oReportId: this.formDataAccept.fSamplereportid, //--oAppFlow为2时，参数必传，为1时不传--报告Id
                    oTestDate: this.formDataAccept.fCompletiondates, //--oAppFlow为2时，参数必传，为1时不传---试验日期
                    oReportNo: this.PostReport, //--oAppFlow为2时，参数必传，为1时不传---报告编号
                    oSampleNo: this.PostSample, //--oAppFlow为2时，参数必传，为1时不传---样品编号
                    oIsCure: this.TestMessage.oIsCure, //--必传---是否养护
                    oInTime: this.TestMessage.oInTime, //--oIsCure为true时，参数必传，为false时不传--入箱时间
                    oYhStorageLocation: this.TestMessage.oYhStorageLocation, //--oIsCure为true时，参数必传，为false时不传---存放位置
                    oStorager: this.TestMessage.oStorager, //--oIsCure为true时，参数必传，为false时不传---存放人
                };

                // this.TestMessage.oBaseInfo.Others = JSON.stringify(this.SampleSxList);//--检验对象属性
                // this.TestMessage.oBaseInfo.MaterialID = null; //--原材料ID
                // this.TestMessage.oBaseInfo.MaterialNo = null; //--原材料编号
                // this.TestMessage.oUserId = Number(this.TestMessage.oUserId); //--oAppFlow为2时，参数必传，为1时不传---用户Id
                // this.TestMessage.oReportId = this.formDataAccept.fSamplereportid;//--oAppFlow为2时，参数必传，为1时不传--报告Id
                // this.TestMessage.oTestDate = this.formDataAccept.fCompletiondates;//--oAppFlow为2时，参数必传，为1时不传---试验日期
                // this.TestMessage.oReportNo = this.PostReport; //--oAppFlow为2时，参数必传，为1时不传---报告编号
                // this.TestMessage.oSampleNo = this.PostSample; //--oAppFlow为2时，参数必传，为1时不传---样品编号
                register(data, this.header, this.SyrjUrl)
                    .then((res) => {
                        if (res.Result == 100) {
                            this.registerList = res.Data;
                            this.saveFun();
                        } else {
                            this.$message.error(res.Msg);
                        }
                    })
                    .catch(() => {
                        console.log("详情接口报错");
                    });
            }, 300);
        },
        // 保存接口
        saveFun() {
            this.loading = true;
            this.isLock = true
            // if (this.formDataAccept.fTestperson != this.formDataAccept.fRealname) {
            //     this.formDataAccept.fTestpersonid = "";
            // }
            var saveData = {
                fId: this.formDataAccept.fId, //传fid表示修改 不传表示新增
                userId: this.userInfo.userId, //当前登录人id
                userName: this.userInfo.realName, //当前登录人姓名
                fSamplereportid: this.formDataAccept.fSamplereportid, //试验名称
                fSamplereportname: this.formDataAccept.fSamplereportname, //试验名称id
                fCompletiondates: this.formDataAccept.fCompletiondates, //预计完成日期
                fTestperson: this.formDataAccept.fTestperson, //试验人
                fTestpersonid: this.formDataAccept.fTestpersonid, //试验人id
                fTestnote: this.formDataAccept.fTestnote, //备注
                fSampleassignnostr: this.PostSample, //样品编号
                fSamplereportnostr: this.PostReport, //报告编号
                fJlid: this.userInfo.jlCompanyId, //监理id
                fJlname: this.userInfo.jlCompanyName, //监理名称
                fReportid: this.registerList.ReportId, //报告id
                fSampleid: this.registerList.SampleId, //样品id
            };
            saveSampleCollection(saveData)
                .then((res) => {
                    if (res.errcode == 0) {
                        this.loading = false;
                        this.$emit("refreshList");
                        this.isLock = false
                        this.visible = false;
                        this.$message.success("收样成功");
                    } else {
                        this.loading = false;
                        this.isLock = false
                        this.$message.error(res.msg);
                        console.log("收样保存报错");
                    }
                })
                .catch(() => {
                    console.log("收样保存接口报错");
                });
        },

        clickDialog(index, prop) {
            // console.log("clickDialog", index, prop);
            // 取样--工程部位/用途
            if (prop == "fProjectlocation") {
                this.WBSShow = true;
            }
            // 收样--选择人
            if (prop == "fTestperson") {
                this.getBaseCompanyList();
            }
            return index, prop;
        },
        // 树选人
        // 树结构
        getBaseCompanyList() {
            this.treeText = {
                companyId: this.userInfo.companyId,
                userId: this.userInfo.userId,
            };
            this.personList = [];
            this.departmentList = [];
            this.dialogEditVisibleTree = true;
            this.loadingEditDialogTree = true;
            getUserCompanyTreeList(this.treeText)
                .then((res) => {
                    this.loadingEditDialogTree = false;
                    if (res.errcode == 0) {
                        this.companyTreeData = res.data.userCompanyTreeList;
                        this.companyInfo = this.tranListToTreePeopleData(
                            res.data.userCompanyTreeList
                        );
                    } else {
                        this.$message.error(res.msg);
                    }
                })
                .catch((error) => {
                    console.log("获取组织机构单位,接口报错", error);
                });
        },
        tranListToTreePeopleData(data) {
            let result = [];
            if (!Array.isArray(data)) {
                return result;
            }
            // 清除已存在的数据  重新赋值
            data.forEach((item) => {
                delete item.children;
            });
            let map = {};
            data.forEach((item) => {
                map[item.fCompanyid] = item;
            });

            data.forEach((item) => {
                let parent = map[item.fParentid];
                if (parent) {
                    (parent.children || (parent.children = [])).push(item);
                } else {
                    result.push(item);
                }
            });
            return result;
        },
        //根据树  调部门
        selectCompany(e) {
            this.getBaseDepartmentUser(e.fCompanyid);
        },
        // 部门管理-查询部门列表以及下属人员
        getBaseDepartmentUser(id) {
            getBaseDepartmentUser({
                fCompanyid: id
            })
                .then((res) => {
                    if (res.errcode == 0) {
                        this.departmentList = res.data.childList;
                    } else {
                        this.$message.error(res.msg);
                    }
                })
                .catch((error) => {
                    console.log("部门管理-查询部门列表以及下属人员,接口报错", error);
                });
        },
        // 选择部门
        seletDepartment(e) {
            this.num = e.fDepartmentId;
            this.personList = [];
            let obj = {};
            // let reduce = [];
            this.personList = e.personList.reduce(function (item, next) {
                //item为没有重复id的数组，next为当前对象
                obj[next.fUserid] ? "" : (obj[next.fUserid] = true && item.push(next));
                return item;
            }, []);
        },
        selectRealname(e, data) {
            data.map((item) => {
                if (e == item.fUserid) {
                    this.newData = item;
                }
            });
        },
        // 保存
        submitMember() {
            this.formDataAccept.fTestperson = this.newData.fRealname;
            this.formDataAccept.fTestpersonid = this.newData.fUserid;
            this.dialogEditVisibleTree = false;
        },
        // 树选人
        // 收样
    },
};